From e4751c9a171b2ac6a05aa67e3527b64ac9cb82d3 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 (cherry picked from commit 38d20d0fef91cfb535697193ad35ff088be1782f) --- arch/x86/configs/tizen_emul_defconfig | 2 +- drivers/char/Kconfig | 4 ---- 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(+), 11 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 3ac256565f13..380568522c81 100644 --- a/arch/x86/configs/tizen_emul_defconfig +++ b/arch/x86/configs/tizen_emul_defconfig @@ -1917,7 +1917,6 @@ CONFIG_HPET=y # CONFIG_TCG_TPM is not set # CONFIG_TELCLOCK is not set CONFIG_DEVPORT=y -CONFIG_VDPRAM_DEVICE=y CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_COMPAT=y @@ -3193,6 +3192,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_EXTENSION_SOURCE is not set diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 0c75793b828d..e4c1e42ccc61 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -600,10 +600,6 @@ config TILE_SROM device appear much like a simple EEPROM, and knows how to partition a single ROM for multiple purposes. -config VDPRAM_DEVICE - tristate "vdpram kernel driver for Telephony simulation" - help - vdpram is telephony simulator works with the event injector. endmenu diff --git a/drivers/char/Makefile b/drivers/char/Makefile index b76eb6cab0db..a324f9303e36 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -61,5 +61,3 @@ obj-$(CONFIG_JS_RTC) += js-rtc.o js-rtc-y = rtc.o obj-$(CONFIG_TILE_SROM) += tile-srom.o - -obj-$(CONFIG_VDPRAM_DEVICE) += vdpram.o diff --git a/drivers/maru/Kconfig b/drivers/maru/Kconfig index 623b349a32fe..691011402f36 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 5b2d4976dd29..5315fb282225 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 fec34ae68c72..3105939e1a5f 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