LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 0/2] clean up misc device minor numbers
@ 2020-03-11  7:16 Zhenzhong Duan
  2020-03-11  7:16 ` [PATCH v2 1/2] misc: cleanup minor number definitions in c file into miscdevice.h Zhenzhong Duan
  2020-03-11  7:16 ` [PATCH v2 2/2] misc: move FLASH_MINOR into miscdevice.h and fix conflicts Zhenzhong Duan
  0 siblings, 2 replies; 5+ messages in thread
From: Zhenzhong Duan @ 2020-03-11  7:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: jdike, richard, anton.ivanov, miguel.ojeda.sandonis, willy,
	ksenija.stanojevic, arnd, gregkh, mpm, herbert, jonathan, benh,
	davem, b.zolnierkie, rjw, pavel, len.brown, Zhenzhong Duan

Some of the misc device minor numbers definitions spread in different
local c files, specially some are duplicate number with different
name, some are same name with conflict numbers, some prefer dynamic
minors.

This patchset try to address all of them.

Thanks Willy and Miguel help building test on ARM arch, no new change
on ARM part in v2 so it should pass build on ARM obviously.

PATCH3 "speakup: misc: Use dynamic minor numbers for speakup devices"
is dropped in v2, will process it separately if there is response from
maintainer later.

v2:
PATCH1: keep HWRNG_MINOR name and fix RNG_MISCDEV_MINOR per Herbert.
PATCH2: fix typo error with PXA3XX_GCU_MINOR per Arnd.

Zhenzhong Duan (2):
  misc: cleanup minor number definitions in c file into miscdevice.h
  misc: move FLASH_MINOR into miscdevice.h and fix conflicts

 arch/arm/include/asm/nwflash.h   |  1 -
 arch/um/drivers/random.c         |  4 +---
 drivers/auxdisplay/charlcd.c     |  2 --
 drivers/auxdisplay/panel.c       |  2 --
 drivers/char/applicom.c          |  1 -
 drivers/char/nwbutton.h          |  1 -
 drivers/char/nwflash.c           |  2 +-
 drivers/char/toshiba.c           |  2 --
 drivers/macintosh/ans-lcd.c      |  2 +-
 drivers/macintosh/ans-lcd.h      |  2 --
 drivers/macintosh/via-pmu.c      |  3 ---
 drivers/sbus/char/envctrl.c      |  2 --
 drivers/sbus/char/flash.c        |  4 +---
 drivers/sbus/char/uctrl.c        |  2 --
 drivers/video/fbdev/pxa3xx-gcu.c |  7 +++----
 include/linux/miscdevice.h       | 12 ++++++++++++
 kernel/power/user.c              |  2 --
 17 files changed, 19 insertions(+), 32 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] misc: cleanup minor number definitions in c file into miscdevice.h
  2020-03-11  7:16 [PATCH v2 0/2] clean up misc device minor numbers Zhenzhong Duan
@ 2020-03-11  7:16 ` Zhenzhong Duan
  2020-03-12  3:11   ` Herbert Xu
  2020-03-20 10:21   ` Bartlomiej Zolnierkiewicz
  2020-03-11  7:16 ` [PATCH v2 2/2] misc: move FLASH_MINOR into miscdevice.h and fix conflicts Zhenzhong Duan
  1 sibling, 2 replies; 5+ messages in thread
From: Zhenzhong Duan @ 2020-03-11  7:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: jdike, richard, anton.ivanov, miguel.ojeda.sandonis, willy,
	ksenija.stanojevic, arnd, gregkh, mpm, herbert, jonathan, benh,
	davem, b.zolnierkie, rjw, pavel, len.brown, Zhenzhong Duan

HWRNG_MINOR and RNG_MISCDEV_MINOR are duplicate definitions, use
unified HWRNG_MINOR instead and moved into miscdevice.h

ANSLCD_MINOR and LCD_MINOR are duplicate definitions, use unified
LCD_MINOR instead and moved into miscdevice.h

MISCDEV_MINOR is renamed to PXA3XX_GCU_MINOR and moved into
miscdevice.h

Other definitions are just moved without any change.

Link: https://lore.kernel.org/lkml/20200120221323.GJ15860@mit.edu/t/
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Build-tested-by: Willy TARREAU <wtarreau@haproxy.com>
Build-tested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/um/drivers/random.c         |  4 +---
 drivers/auxdisplay/charlcd.c     |  2 --
 drivers/auxdisplay/panel.c       |  2 --
 drivers/char/applicom.c          |  1 -
 drivers/char/nwbutton.h          |  1 -
 drivers/char/toshiba.c           |  2 --
 drivers/macintosh/ans-lcd.c      |  2 +-
 drivers/macintosh/ans-lcd.h      |  2 --
 drivers/macintosh/via-pmu.c      |  3 ---
 drivers/sbus/char/envctrl.c      |  2 --
 drivers/sbus/char/uctrl.c        |  2 --
 drivers/video/fbdev/pxa3xx-gcu.c |  7 +++----
 include/linux/miscdevice.h       | 10 ++++++++++
 kernel/power/user.c              |  2 --
 14 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c
index 1d5d305..ce115fc 100644
--- a/arch/um/drivers/random.c
+++ b/arch/um/drivers/random.c
@@ -23,8 +23,6 @@
 #define RNG_VERSION "1.0.0"
 #define RNG_MODULE_NAME "hw_random"
 
-#define RNG_MISCDEV_MINOR		183 /* official */
-
 /* Changed at init time, in the non-modular case, and at module load
  * time, in the module case.  Presumably, the module subsystem
  * protects against a module being loaded twice at the same time.
@@ -104,7 +102,7 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
 
 /* rng_init shouldn't be called more than once at boot time */
 static struct miscdevice rng_miscdev = {
-	RNG_MISCDEV_MINOR,
+	HWRNG_MINOR,
 	RNG_MODULE_NAME,
 	&rng_chrdev_ops,
 };
diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index c0da382..d58278a 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -22,8 +22,6 @@
 
 #include "charlcd.h"
 
-#define LCD_MINOR		156
-
 #define DEFAULT_LCD_BWIDTH      40
 #define DEFAULT_LCD_HWIDTH      64
 
diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
index 85965953..99980aa 100644
--- a/drivers/auxdisplay/panel.c
+++ b/drivers/auxdisplay/panel.c
@@ -57,8 +57,6 @@
 
 #include "charlcd.h"
 
-#define KEYPAD_MINOR		185
-
 #define LCD_MAXBYTES		256	/* max burst write */
 
 #define KEYPAD_BUFFER		64
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 51121a4..14b2d80 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -53,7 +53,6 @@
 #define MAX_BOARD 8		/* maximum of pc board possible */
 #define MAX_ISA_BOARD 4
 #define LEN_RAM_IO 0x800
-#define AC_MINOR 157
 
 #ifndef PCI_VENDOR_ID_APPLICOM
 #define PCI_VENDOR_ID_APPLICOM                0x1389
diff --git a/drivers/char/nwbutton.h b/drivers/char/nwbutton.h
index 9dedfd7..f2b9fdc 100644
--- a/drivers/char/nwbutton.h
+++ b/drivers/char/nwbutton.h
@@ -14,7 +14,6 @@
 #define NUM_PRESSES_REBOOT 2	/* How many presses to activate shutdown */
 #define BUTTON_DELAY 30 	/* How many jiffies for sequence to end */
 #define VERSION "0.3"		/* Driver version number */
-#define BUTTON_MINOR 158	/* Major 10, Minor 158, /dev/nwbutton */
 
 /* Structure definitions: */
 
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 98f3150..aff0a8e 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -61,8 +61,6 @@
 #include <linux/mutex.h>
 #include <linux/toshiba.h>
 
-#define TOSH_MINOR_DEV 181
-
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
 MODULE_DESCRIPTION("Toshiba laptop SMM driver");
diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c
index b1314d1..b4821c7 100644
--- a/drivers/macintosh/ans-lcd.c
+++ b/drivers/macintosh/ans-lcd.c
@@ -142,7 +142,7 @@
 };
 
 static struct miscdevice anslcd_dev = {
-	ANSLCD_MINOR,
+	LCD_MINOR,
 	"anslcd",
 	&anslcd_fops
 };
diff --git a/drivers/macintosh/ans-lcd.h b/drivers/macintosh/ans-lcd.h
index f0a6e4c..bca7d76 100644
--- a/drivers/macintosh/ans-lcd.h
+++ b/drivers/macintosh/ans-lcd.h
@@ -2,8 +2,6 @@
 #ifndef _PPC_ANS_LCD_H
 #define _PPC_ANS_LCD_H
 
-#define ANSLCD_MINOR		156
-
 #define ANSLCD_CLEAR		0x01
 #define ANSLCD_SENDCTRL		0x02
 #define ANSLCD_SETSHORTDELAY	0x03
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index d38fb78..83eb05b 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -75,9 +75,6 @@
 /* Some compile options */
 #undef DEBUG_SLEEP
 
-/* Misc minor number allocated for /dev/pmu */
-#define PMU_MINOR		154
-
 /* How many iterations between battery polls */
 #define BATTERY_POLLING_COUNT	2
 
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index 12d66aa..843e830 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -37,8 +37,6 @@
 #define DRIVER_NAME	"envctrl"
 #define PFX		DRIVER_NAME ": "
 
-#define ENVCTRL_MINOR	162
-
 #define PCF8584_ADDRESS	0x55
 
 #define CONTROL_PIN	0x80
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index 7173a2e..37d252f2 100644
--- a/drivers/sbus/char/uctrl.c
+++ b/drivers/sbus/char/uctrl.c
@@ -23,8 +23,6 @@
 #include <asm/io.h>
 #include <asm/pgtable.h>
 
-#define UCTRL_MINOR	174
-
 #define DEBUG 1
 #ifdef DEBUG
 #define dprintk(x) printk x
diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c
index 74ffb44..4279e13 100644
--- a/drivers/video/fbdev/pxa3xx-gcu.c
+++ b/drivers/video/fbdev/pxa3xx-gcu.c
@@ -36,7 +36,6 @@
 #include "pxa3xx-gcu.h"
 
 #define DRV_NAME	"pxa3xx-gcu"
-#define MISCDEV_MINOR	197
 
 #define REG_GCCR	0x00
 #define GCCR_SYNC_CLR	(1 << 9)
@@ -595,7 +594,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
 	 * container_of(). This isn't really necessary as we have a fixed minor
 	 * number anyway, but this is to avoid statics. */
 
-	priv->misc_dev.minor	= MISCDEV_MINOR,
+	priv->misc_dev.minor	= PXA3XX_GCU_MINOR,
 	priv->misc_dev.name	= DRV_NAME,
 	priv->misc_dev.fops	= &pxa3xx_gcu_miscdev_fops;
 
@@ -638,7 +637,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
 	ret = misc_register(&priv->misc_dev);
 	if (ret < 0) {
 		dev_err(dev, "misc_register() for minor %d failed\n",
-			MISCDEV_MINOR);
+			PXA3XX_GCU_MINOR);
 		goto err_free_dma;
 	}
 
@@ -714,7 +713,7 @@ static int pxa3xx_gcu_remove(struct platform_device *pdev)
 
 MODULE_DESCRIPTION("PXA3xx graphics controller unit driver");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_MISCDEV(MISCDEV_MINOR);
+MODULE_ALIAS_MISCDEV(PXA3XX_GCU_MINOR);
 MODULE_AUTHOR("Janine Kropp <nin@directfb.org>, "
 		"Denis Oliver Kropp <dok@directfb.org>, "
 		"Daniel Mack <daniel@caiaq.de>");
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index becde69..42360fc 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -31,14 +31,23 @@
 #define DMAPI_MINOR		140	/* unused */
 #define NVRAM_MINOR		144
 #define SGI_MMTIMER		153
+#define PMU_MINOR		154
 #define STORE_QUEUE_MINOR	155	/* unused */
+#define LCD_MINOR		156
+#define AC_MINOR		157
+#define BUTTON_MINOR		158	/* Major 10, Minor 158, /dev/nwbutton */
+#define ENVCTRL_MINOR		162
 #define I2O_MINOR		166
+#define UCTRL_MINOR		174
 #define AGPGART_MINOR		175
+#define TOSH_MINOR_DEV		181
 #define HWRNG_MINOR		183
 #define MICROCODE_MINOR		184
+#define KEYPAD_MINOR		185
 #define IRNET_MINOR		187
 #define D7S_MINOR		193
 #define VFIO_MINOR		196
+#define PXA3XX_GCU_MINOR	197
 #define TUN_MINOR		200
 #define CUSE_MINOR		203
 #define MWAVE_MINOR		219	/* ACP/Mwave Modem */
@@ -49,6 +58,7 @@
 #define MISC_MCELOG_MINOR	227
 #define HPET_MINOR		228
 #define FUSE_MINOR		229
+#define SNAPSHOT_MINOR		231
 #define KVM_MINOR		232
 #define BTRFS_MINOR		234
 #define AUTOFS_MINOR		235
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 7743895..98fb659 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -27,8 +27,6 @@
 #include "power.h"
 
 
-#define SNAPSHOT_MINOR	231
-
 static struct snapshot_data {
 	struct snapshot_handle handle;
 	int swap;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] misc: move FLASH_MINOR into miscdevice.h and fix conflicts
  2020-03-11  7:16 [PATCH v2 0/2] clean up misc device minor numbers Zhenzhong Duan
  2020-03-11  7:16 ` [PATCH v2 1/2] misc: cleanup minor number definitions in c file into miscdevice.h Zhenzhong Duan
@ 2020-03-11  7:16 ` Zhenzhong Duan
  1 sibling, 0 replies; 5+ messages in thread
From: Zhenzhong Duan @ 2020-03-11  7:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: jdike, richard, anton.ivanov, miguel.ojeda.sandonis, willy,
	ksenija.stanojevic, arnd, gregkh, mpm, herbert, jonathan, benh,
	davem, b.zolnierkie, rjw, pavel, len.brown, Zhenzhong Duan,
	Russell King

FLASH_MINOR is used in both drivers/char/nwflash.c and
drivers/sbus/char/flash.c with conflict minor numbers.

Move all the definitions of FLASH_MINOR into miscdevice.h.
Rename FLASH_MINOR for drivers/char/nwflash.c to NWFLASH_MINOR
and FLASH_MINOR for drivers/sbus/char/flash.c to SBUS_FLASH_MINOR.

Link: https://lore.kernel.org/lkml/20200120221323.GJ15860@mit.edu/t/
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/arm/include/asm/nwflash.h | 1 -
 drivers/char/nwflash.c         | 2 +-
 drivers/sbus/char/flash.c      | 4 +---
 include/linux/miscdevice.h     | 2 ++
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/nwflash.h b/arch/arm/include/asm/nwflash.h
index 0ec6f07..66b7e68 100644
--- a/arch/arm/include/asm/nwflash.h
+++ b/arch/arm/include/asm/nwflash.h
@@ -2,7 +2,6 @@
 #ifndef _FLASH_H
 #define _FLASH_H
 
-#define FLASH_MINOR		 160	/* MAJOR is 10 - miscdevice */
 #define CMD_WRITE_DISABLE	 0
 #define CMD_WRITE_ENABLE	 0x28
 #define CMD_WRITE_BASE64K_ENABLE 0x47
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c
index a4a0797d..0973c2c 100644
--- a/drivers/char/nwflash.c
+++ b/drivers/char/nwflash.c
@@ -576,7 +576,7 @@ static void kick_open(void)
 
 static struct miscdevice flash_miscdev =
 {
-	FLASH_MINOR,
+	NWFLASH_MINOR,
 	"nwflash",
 	&flash_fops
 };
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index e85a05a..4147d22 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -31,8 +31,6 @@
 	unsigned long busy;		/* In use? */
 } flash;
 
-#define FLASH_MINOR	152
-
 static int
 flash_mmap(struct file *file, struct vm_area_struct *vma)
 {
@@ -157,7 +155,7 @@
 	.release =	flash_release,
 };
 
-static struct miscdevice flash_dev = { FLASH_MINOR, "flash", &flash_fops };
+static struct miscdevice flash_dev = { SBUS_FLASH_MINOR, "flash", &flash_fops };
 
 static int flash_probe(struct platform_device *op)
 {
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 42360fc..66cc45e 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -30,12 +30,14 @@
 #define SUN_OPENPROM_MINOR	139
 #define DMAPI_MINOR		140	/* unused */
 #define NVRAM_MINOR		144
+#define SBUS_FLASH_MINOR	152
 #define SGI_MMTIMER		153
 #define PMU_MINOR		154
 #define STORE_QUEUE_MINOR	155	/* unused */
 #define LCD_MINOR		156
 #define AC_MINOR		157
 #define BUTTON_MINOR		158	/* Major 10, Minor 158, /dev/nwbutton */
+#define NWFLASH_MINOR		160	/* MAJOR is 10 - miscdevice */
 #define ENVCTRL_MINOR		162
 #define I2O_MINOR		166
 #define UCTRL_MINOR		174
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] misc: cleanup minor number definitions in c file into miscdevice.h
  2020-03-11  7:16 ` [PATCH v2 1/2] misc: cleanup minor number definitions in c file into miscdevice.h Zhenzhong Duan
@ 2020-03-12  3:11   ` Herbert Xu
  2020-03-20 10:21   ` Bartlomiej Zolnierkiewicz
  1 sibling, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2020-03-12  3:11 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: linux-kernel, jdike, richard, anton.ivanov,
	miguel.ojeda.sandonis, willy, ksenija.stanojevic, arnd, gregkh,
	mpm, jonathan, benh, davem, b.zolnierkie, rjw, pavel, len.brown

On Wed, Mar 11, 2020 at 03:16:53PM +0800, Zhenzhong Duan wrote:
> HWRNG_MINOR and RNG_MISCDEV_MINOR are duplicate definitions, use
> unified HWRNG_MINOR instead and moved into miscdevice.h
> 
> ANSLCD_MINOR and LCD_MINOR are duplicate definitions, use unified
> LCD_MINOR instead and moved into miscdevice.h
> 
> MISCDEV_MINOR is renamed to PXA3XX_GCU_MINOR and moved into
> miscdevice.h
> 
> Other definitions are just moved without any change.
> 
> Link: https://lore.kernel.org/lkml/20200120221323.GJ15860@mit.edu/t/
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Build-tested-by: Willy TARREAU <wtarreau@haproxy.com>
> Build-tested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
> Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  arch/um/drivers/random.c         |  4 +---
>  drivers/auxdisplay/charlcd.c     |  2 --
>  drivers/auxdisplay/panel.c       |  2 --
>  drivers/char/applicom.c          |  1 -
>  drivers/char/nwbutton.h          |  1 -
>  drivers/char/toshiba.c           |  2 --
>  drivers/macintosh/ans-lcd.c      |  2 +-
>  drivers/macintosh/ans-lcd.h      |  2 --
>  drivers/macintosh/via-pmu.c      |  3 ---
>  drivers/sbus/char/envctrl.c      |  2 --
>  drivers/sbus/char/uctrl.c        |  2 --
>  drivers/video/fbdev/pxa3xx-gcu.c |  7 +++----
>  include/linux/miscdevice.h       | 10 ++++++++++
>  kernel/power/user.c              |  2 --
>  14 files changed, 15 insertions(+), 27 deletions(-)

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] misc: cleanup minor number definitions in c file into miscdevice.h
  2020-03-11  7:16 ` [PATCH v2 1/2] misc: cleanup minor number definitions in c file into miscdevice.h Zhenzhong Duan
  2020-03-12  3:11   ` Herbert Xu
@ 2020-03-20 10:21   ` Bartlomiej Zolnierkiewicz
  1 sibling, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2020-03-20 10:21 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: linux-kernel, jdike, richard, anton.ivanov,
	miguel.ojeda.sandonis, willy, ksenija.stanojevic, arnd, gregkh,
	mpm, herbert, jonathan, benh, davem, rjw, pavel, len.brown


On 3/11/20 8:16 AM, Zhenzhong Duan wrote:
> HWRNG_MINOR and RNG_MISCDEV_MINOR are duplicate definitions, use
> unified HWRNG_MINOR instead and moved into miscdevice.h
> 
> ANSLCD_MINOR and LCD_MINOR are duplicate definitions, use unified
> LCD_MINOR instead and moved into miscdevice.h
> 
> MISCDEV_MINOR is renamed to PXA3XX_GCU_MINOR and moved into
> miscdevice.h
> 
> Other definitions are just moved without any change.
> 
> Link: https://protect2.fireeye.com/url?k=5cdcd693-0116e324-5cdd5ddc-0cc47a3003e8-9aee128ff3e02503&u=https://lore.kernel.org/lkml/20200120221323.GJ15860@mit.edu/t/
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Build-tested-by: Willy TARREAU <wtarreau@haproxy.com>
> Build-tested-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
> Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> ---
>  arch/um/drivers/random.c         |  4 +---
>  drivers/auxdisplay/charlcd.c     |  2 --
>  drivers/auxdisplay/panel.c       |  2 --
>  drivers/char/applicom.c          |  1 -
>  drivers/char/nwbutton.h          |  1 -
>  drivers/char/toshiba.c           |  2 --
>  drivers/macintosh/ans-lcd.c      |  2 +-
>  drivers/macintosh/ans-lcd.h      |  2 --
>  drivers/macintosh/via-pmu.c      |  3 ---
>  drivers/sbus/char/envctrl.c      |  2 --
>  drivers/sbus/char/uctrl.c        |  2 --
>  drivers/video/fbdev/pxa3xx-gcu.c |  7 +++----
>  include/linux/miscdevice.h       | 10 ++++++++++
>  kernel/power/user.c              |  2 --
>  14 files changed, 15 insertions(+), 27 deletions(-)
> 
> diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c
> index 1d5d305..ce115fc 100644
> --- a/arch/um/drivers/random.c
> +++ b/arch/um/drivers/random.c
> @@ -23,8 +23,6 @@
>  #define RNG_VERSION "1.0.0"
>  #define RNG_MODULE_NAME "hw_random"
>  
> -#define RNG_MISCDEV_MINOR		183 /* official */
> -
>  /* Changed at init time, in the non-modular case, and at module load
>   * time, in the module case.  Presumably, the module subsystem
>   * protects against a module being loaded twice at the same time.
> @@ -104,7 +102,7 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
>  
>  /* rng_init shouldn't be called more than once at boot time */
>  static struct miscdevice rng_miscdev = {
> -	RNG_MISCDEV_MINOR,
> +	HWRNG_MINOR,
>  	RNG_MODULE_NAME,
>  	&rng_chrdev_ops,
>  };
> diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
> index c0da382..d58278a 100644
> --- a/drivers/auxdisplay/charlcd.c
> +++ b/drivers/auxdisplay/charlcd.c
> @@ -22,8 +22,6 @@
>  
>  #include "charlcd.h"
>  
> -#define LCD_MINOR		156
> -
>  #define DEFAULT_LCD_BWIDTH      40
>  #define DEFAULT_LCD_HWIDTH      64
>  
> diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
> index 85965953..99980aa 100644
> --- a/drivers/auxdisplay/panel.c
> +++ b/drivers/auxdisplay/panel.c
> @@ -57,8 +57,6 @@
>  
>  #include "charlcd.h"
>  
> -#define KEYPAD_MINOR		185
> -
>  #define LCD_MAXBYTES		256	/* max burst write */
>  
>  #define KEYPAD_BUFFER		64
> diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
> index 51121a4..14b2d80 100644
> --- a/drivers/char/applicom.c
> +++ b/drivers/char/applicom.c
> @@ -53,7 +53,6 @@
>  #define MAX_BOARD 8		/* maximum of pc board possible */
>  #define MAX_ISA_BOARD 4
>  #define LEN_RAM_IO 0x800
> -#define AC_MINOR 157
>  
>  #ifndef PCI_VENDOR_ID_APPLICOM
>  #define PCI_VENDOR_ID_APPLICOM                0x1389
> diff --git a/drivers/char/nwbutton.h b/drivers/char/nwbutton.h
> index 9dedfd7..f2b9fdc 100644
> --- a/drivers/char/nwbutton.h
> +++ b/drivers/char/nwbutton.h
> @@ -14,7 +14,6 @@
>  #define NUM_PRESSES_REBOOT 2	/* How many presses to activate shutdown */
>  #define BUTTON_DELAY 30 	/* How many jiffies for sequence to end */
>  #define VERSION "0.3"		/* Driver version number */
> -#define BUTTON_MINOR 158	/* Major 10, Minor 158, /dev/nwbutton */
>  
>  /* Structure definitions: */
>  
> diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
> index 98f3150..aff0a8e 100644
> --- a/drivers/char/toshiba.c
> +++ b/drivers/char/toshiba.c
> @@ -61,8 +61,6 @@
>  #include <linux/mutex.h>
>  #include <linux/toshiba.h>
>  
> -#define TOSH_MINOR_DEV 181
> -
>  MODULE_LICENSE("GPL");
>  MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
>  MODULE_DESCRIPTION("Toshiba laptop SMM driver");
> diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c
> index b1314d1..b4821c7 100644
> --- a/drivers/macintosh/ans-lcd.c
> +++ b/drivers/macintosh/ans-lcd.c
> @@ -142,7 +142,7 @@
>  };
>  
>  static struct miscdevice anslcd_dev = {
> -	ANSLCD_MINOR,
> +	LCD_MINOR,
>  	"anslcd",
>  	&anslcd_fops
>  };
> diff --git a/drivers/macintosh/ans-lcd.h b/drivers/macintosh/ans-lcd.h
> index f0a6e4c..bca7d76 100644
> --- a/drivers/macintosh/ans-lcd.h
> +++ b/drivers/macintosh/ans-lcd.h
> @@ -2,8 +2,6 @@
>  #ifndef _PPC_ANS_LCD_H
>  #define _PPC_ANS_LCD_H
>  
> -#define ANSLCD_MINOR		156
> -
>  #define ANSLCD_CLEAR		0x01
>  #define ANSLCD_SENDCTRL		0x02
>  #define ANSLCD_SETSHORTDELAY	0x03
> diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
> index d38fb78..83eb05b 100644
> --- a/drivers/macintosh/via-pmu.c
> +++ b/drivers/macintosh/via-pmu.c
> @@ -75,9 +75,6 @@
>  /* Some compile options */
>  #undef DEBUG_SLEEP
>  
> -/* Misc minor number allocated for /dev/pmu */
> -#define PMU_MINOR		154
> -
>  /* How many iterations between battery polls */
>  #define BATTERY_POLLING_COUNT	2
>  
> diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
> index 12d66aa..843e830 100644
> --- a/drivers/sbus/char/envctrl.c
> +++ b/drivers/sbus/char/envctrl.c
> @@ -37,8 +37,6 @@
>  #define DRIVER_NAME	"envctrl"
>  #define PFX		DRIVER_NAME ": "
>  
> -#define ENVCTRL_MINOR	162
> -
>  #define PCF8584_ADDRESS	0x55
>  
>  #define CONTROL_PIN	0x80
> diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
> index 7173a2e..37d252f2 100644
> --- a/drivers/sbus/char/uctrl.c
> +++ b/drivers/sbus/char/uctrl.c
> @@ -23,8 +23,6 @@
>  #include <asm/io.h>
>  #include <asm/pgtable.h>
>  
> -#define UCTRL_MINOR	174
> -
>  #define DEBUG 1
>  #ifdef DEBUG
>  #define dprintk(x) printk x
> diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c
> index 74ffb44..4279e13 100644
> --- a/drivers/video/fbdev/pxa3xx-gcu.c
> +++ b/drivers/video/fbdev/pxa3xx-gcu.c
> @@ -36,7 +36,6 @@
>  #include "pxa3xx-gcu.h"
>  
>  #define DRV_NAME	"pxa3xx-gcu"
> -#define MISCDEV_MINOR	197
>  
>  #define REG_GCCR	0x00
>  #define GCCR_SYNC_CLR	(1 << 9)
> @@ -595,7 +594,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
>  	 * container_of(). This isn't really necessary as we have a fixed minor
>  	 * number anyway, but this is to avoid statics. */
>  
> -	priv->misc_dev.minor	= MISCDEV_MINOR,
> +	priv->misc_dev.minor	= PXA3XX_GCU_MINOR,
>  	priv->misc_dev.name	= DRV_NAME,
>  	priv->misc_dev.fops	= &pxa3xx_gcu_miscdev_fops;
>  
> @@ -638,7 +637,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
>  	ret = misc_register(&priv->misc_dev);
>  	if (ret < 0) {
>  		dev_err(dev, "misc_register() for minor %d failed\n",
> -			MISCDEV_MINOR);
> +			PXA3XX_GCU_MINOR);
>  		goto err_free_dma;
>  	}
>  
> @@ -714,7 +713,7 @@ static int pxa3xx_gcu_remove(struct platform_device *pdev)
>  
>  MODULE_DESCRIPTION("PXA3xx graphics controller unit driver");
>  MODULE_LICENSE("GPL");
> -MODULE_ALIAS_MISCDEV(MISCDEV_MINOR);
> +MODULE_ALIAS_MISCDEV(PXA3XX_GCU_MINOR);
>  MODULE_AUTHOR("Janine Kropp <nin@directfb.org>, "
>  		"Denis Oliver Kropp <dok@directfb.org>, "
>  		"Daniel Mack <daniel@caiaq.de>");
> diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
> index becde69..42360fc 100644
> --- a/include/linux/miscdevice.h
> +++ b/include/linux/miscdevice.h
> @@ -31,14 +31,23 @@
>  #define DMAPI_MINOR		140	/* unused */
>  #define NVRAM_MINOR		144
>  #define SGI_MMTIMER		153
> +#define PMU_MINOR		154
>  #define STORE_QUEUE_MINOR	155	/* unused */
> +#define LCD_MINOR		156
> +#define AC_MINOR		157
> +#define BUTTON_MINOR		158	/* Major 10, Minor 158, /dev/nwbutton */
> +#define ENVCTRL_MINOR		162
>  #define I2O_MINOR		166
> +#define UCTRL_MINOR		174
>  #define AGPGART_MINOR		175
> +#define TOSH_MINOR_DEV		181
>  #define HWRNG_MINOR		183
>  #define MICROCODE_MINOR		184
> +#define KEYPAD_MINOR		185
>  #define IRNET_MINOR		187
>  #define D7S_MINOR		193
>  #define VFIO_MINOR		196
> +#define PXA3XX_GCU_MINOR	197
>  #define TUN_MINOR		200
>  #define CUSE_MINOR		203
>  #define MWAVE_MINOR		219	/* ACP/Mwave Modem */
> @@ -49,6 +58,7 @@
>  #define MISC_MCELOG_MINOR	227
>  #define HPET_MINOR		228
>  #define FUSE_MINOR		229
> +#define SNAPSHOT_MINOR		231
>  #define KVM_MINOR		232
>  #define BTRFS_MINOR		234
>  #define AUTOFS_MINOR		235
> diff --git a/kernel/power/user.c b/kernel/power/user.c
> index 7743895..98fb659 100644
> --- a/kernel/power/user.c
> +++ b/kernel/power/user.c
> @@ -27,8 +27,6 @@
>  #include "power.h"
>  
>  
> -#define SNAPSHOT_MINOR	231
> -
>  static struct snapshot_data {
>  	struct snapshot_handle handle;
>  	int swap;
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-20 10:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11  7:16 [PATCH v2 0/2] clean up misc device minor numbers Zhenzhong Duan
2020-03-11  7:16 ` [PATCH v2 1/2] misc: cleanup minor number definitions in c file into miscdevice.h Zhenzhong Duan
2020-03-12  3:11   ` Herbert Xu
2020-03-20 10:21   ` Bartlomiej Zolnierkiewicz
2020-03-11  7:16 ` [PATCH v2 2/2] misc: move FLASH_MINOR into miscdevice.h and fix conflicts Zhenzhong Duan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).