Skip to content

Commit

Permalink
misc: cleanup minor number definitions in c file into miscdevice.h
Browse files Browse the repository at this point in the history
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>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Link: https://lore.kernel.org/r/20200311071654.335-2-zhenzhong.duan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Zhenzhong Duan authored and Greg Kroah-Hartman committed Mar 18, 2020
1 parent c23df7d commit 6ce6ae7
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 27 deletions.
4 changes: 1 addition & 3 deletions arch/um/drivers/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -104,7 +102,7 @@ static const struct file_operations rng_chrdev_ops = {

/* 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,
};
Expand Down
2 changes: 0 additions & 2 deletions drivers/auxdisplay/charlcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

#include "charlcd.h"

#define LCD_MINOR 156

#define DEFAULT_LCD_BWIDTH 40
#define DEFAULT_LCD_HWIDTH 64

Expand Down
2 changes: 0 additions & 2 deletions drivers/auxdisplay/panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@

#include "charlcd.h"

#define KEYPAD_MINOR 185

#define LCD_MAXBYTES 256 /* max burst write */

#define KEYPAD_BUFFER 64
Expand Down
1 change: 0 additions & 1 deletion drivers/char/applicom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion drivers/char/nwbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -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: */

Expand Down
2 changes: 0 additions & 2 deletions drivers/char/toshiba.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion drivers/macintosh/ans-lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const struct file_operations anslcd_fops = {
};

static struct miscdevice anslcd_dev = {
ANSLCD_MINOR,
LCD_MINOR,
"anslcd",
&anslcd_fops
};
Expand Down
2 changes: 0 additions & 2 deletions drivers/macintosh/ans-lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions drivers/macintosh/via-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions drivers/sbus/char/envctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
#define DRIVER_NAME "envctrl"
#define PFX DRIVER_NAME ": "

#define ENVCTRL_MINOR 162

#define PCF8584_ADDRESS 0x55

#define CONTROL_PIN 0x80
Expand Down
2 changes: 0 additions & 2 deletions drivers/sbus/char/uctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions drivers/video/fbdev/pxa3xx-gcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -714,7 +713,7 @@ module_platform_driver(pxa3xx_gcu_driver);

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>");
10 changes: 10 additions & 0 deletions include/linux/miscdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions kernel/power/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include "power.h"


#define SNAPSHOT_MINOR 231

static struct snapshot_data {
struct snapshot_handle handle;
int swap;
Expand Down

0 comments on commit 6ce6ae7

Please sign in to comment.