From 38d20d0fef91cfb535697193ad35ff088be1782f Mon Sep 17 00:00:00 2001 From: Sooyoung Ha Date: Thu, 7 Jul 2016 18:20:11 +0900 Subject: [PATCH] vdpram: modify vdpram char device number It is fixed so far, it could cause probing error. So I modify it to choose the major number dynamically. And move it into 'maru' directory. Change-Id: Ic46e71541f83bd227e03e1c0f17295029d319ba0 Signed-off-by: Sooyoung Ha --- arch/x86/configs/tizen_emul_defconfig | 2 +- drivers/char/Kconfig | 5 ----- drivers/char/Makefile | 2 -- drivers/maru/Kconfig | 4 ++++ drivers/maru/Makefile | 1 + drivers/{char/vdpram.c => maru/maru_vdpram.c} | 8 ++++---- 6 files changed, 10 insertions(+), 12 deletions(-) rename drivers/{char/vdpram.c => maru/maru_vdpram.c} (99%) diff --git a/arch/x86/configs/tizen_emul_defconfig b/arch/x86/configs/tizen_emul_defconfig index b11f5c7d8b94..61dafc64bb5c 100644 --- a/arch/x86/configs/tizen_emul_defconfig +++ b/arch/x86/configs/tizen_emul_defconfig @@ -2066,7 +2066,6 @@ CONFIG_HPET=y # CONFIG_TELCLOCK is not set CONFIG_DEVPORT=y # CONFIG_XILLYBUS is not set -CONFIG_VDPRAM=y # # I2C support @@ -3531,6 +3530,7 @@ CONFIG_MARU_VIRTIO_EVDI=y CONFIG_MARU_VIRTIO_SENSOR=y CONFIG_MARU_VIRTIO_NFC=y CONFIG_MARU_BRILLCODEC=y +CONFIG_MARU_VDPRAM=y CONFIG_MARU_VIRTIO_VMODEM=y CONFIG_MARU_VIRTIO_ROTARY=y CONFIG_MARU_TV=y diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 24f6c7b3f754..a043107da2af 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -603,10 +603,5 @@ config TILE_SROM source "drivers/char/xillybus/Kconfig" -config VDPRAM - tristate "vdpram kernel driver for VMODEM" - help - vdpram is a telephony driver works with the Emulator Control Panel. - endmenu diff --git a/drivers/char/Makefile b/drivers/char/Makefile index a2e431df6f49..d8a7579300d2 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -60,5 +60,3 @@ js-rtc-y = rtc.o obj-$(CONFIG_TILE_SROM) += tile-srom.o obj-$(CONFIG_XILLYBUS) += xillybus/ - -obj-$(CONFIG_VDPRAM) += vdpram.o diff --git a/drivers/maru/Kconfig b/drivers/maru/Kconfig index b2e30d156262..b3ab0b5d0515 100644 --- a/drivers/maru/Kconfig +++ b/drivers/maru/Kconfig @@ -54,6 +54,10 @@ config MARU_BRILLCODEC tristate "MARU brillcodec driver" depends on MARU != n +config MARU_VDPRAM + tristate "vdpram kernel driver for VMODEM" + depends on MARU != n + config MARU_VIRTIO_VMODEM tristate "MARU VirtIO Virtual Modem Device Driver" depends on MARU != n diff --git a/drivers/maru/Makefile b/drivers/maru/Makefile index 87213e441301..0eade0d194a9 100644 --- a/drivers/maru/Makefile +++ b/drivers/maru/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_MARU_VIRTIO_NFC) += maru_virtio_nfc.o obj-$(CONFIG_MARU_VIRTIO_EVDI) += maru_virtio_evdi.o obj-$(CONFIG_MARU_VIRTIO_SENSOR) += sensors/ #maru_virtio_sensor.o obj-$(CONFIG_MARU_BRILLCODEC) += maru_brillcodec.o +obj-$(CONFIG_MARU_VDPRAM) += maru_vdpram.o obj-$(CONFIG_MARU_VIRTIO_VMODEM) += maru_virtio_vmodem.o obj-$(CONFIG_MARU_VIRTIO_ROTARY) += maru_virtio_rotary.o obj-$(CONFIG_MARU_VIRTIO_TABLET) += maru_virtio_tablet.o diff --git a/drivers/char/vdpram.c b/drivers/maru/maru_vdpram.c similarity index 99% rename from drivers/char/vdpram.c rename to drivers/maru/maru_vdpram.c index 4f6cfed47f9e..ccc1f96177a2 100644 --- a/drivers/char/vdpram.c +++ b/drivers/maru/maru_vdpram.c @@ -42,7 +42,6 @@ #include #include -#define VDPRAM_MAJOR 249 /* 240 */ #define VDPRAM_NR_DEVS 2 #define VDPRAM_BUFFER (16*1024) #define VDPRAM_SEM_UNLOCK 100 @@ -98,7 +97,7 @@ struct vdpram_status_dev { static int vdpram_nr_devs = VDPRAM_NR_DEVS; /* number of devices */ int vdpram_buffer = VDPRAM_BUFFER; /* buffer size */ dev_t vdpram_devno; /* Our first device number */ -int vdpram_major = VDPRAM_MAJOR; +int vdpram_major = 0; module_param(vdpram_nr_devs, int, 0); /* FIXME check perms */ module_param(vdpram_buffer, int, 0); @@ -607,15 +606,16 @@ static char *vdpram_devnode(struct device *dev, umode_t *mode) int vdpram_init(void) { int i, result; - dev_t dev = MKDEV(vdpram_major, 0); + dev_t dev = 0; printk("Initializing vdpram device driver ...\n"); - result = register_chrdev_region(dev, vdpram_nr_devs, "vdpram"); + result = alloc_chrdev_region(&dev, 0, vdpram_nr_devs, "vdpram"); if (result < 0) { printk("Unable to get vdpram region, error %d\n", result); goto err_out; } + vdpram_major = MAJOR(dev); printk("vdpram device major num = %d \n", vdpram_major); vdpram_devno = dev; -- 2.34.1