Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_MISCDEVICE_H
0003 #define _LINUX_MISCDEVICE_H
0004 #include <linux/major.h>
0005 #include <linux/list.h>
0006 #include <linux/types.h>
0007 #include <linux/device.h>
0008 
0009 /*
0010  *  These allocations are managed by device@lanana.org. If you need
0011  *  an entry that is not assigned here, it can be moved and
0012  *  reassigned or dynamically set if a fixed value is not justified.
0013  */
0014 
0015 #define PSMOUSE_MINOR       1
0016 #define MS_BUSMOUSE_MINOR   2   /* unused */
0017 #define ATIXL_BUSMOUSE_MINOR    3   /* unused */
0018 /*#define AMIGAMOUSE_MINOR  4   FIXME OBSOLETE */
0019 #define ATARIMOUSE_MINOR    5   /* unused */
0020 #define SUN_MOUSE_MINOR     6   /* unused */
0021 #define APOLLO_MOUSE_MINOR  7   /* unused */
0022 #define PC110PAD_MINOR      9   /* unused */
0023 /*#define ADB_MOUSE_MINOR   10  FIXME OBSOLETE */
0024 #define WATCHDOG_MINOR      130 /* Watchdog timer     */
0025 #define TEMP_MINOR      131 /* Temperature Sensor */
0026 #define APM_MINOR_DEV       134
0027 #define RTC_MINOR       135
0028 /*#define EFI_RTC_MINOR     136 was EFI Time services */
0029 #define VHCI_MINOR      137
0030 #define SUN_OPENPROM_MINOR  139
0031 #define DMAPI_MINOR     140 /* unused */
0032 #define NVRAM_MINOR     144
0033 #define SBUS_FLASH_MINOR    152
0034 #define SGI_MMTIMER     153
0035 #define PMU_MINOR       154
0036 #define STORE_QUEUE_MINOR   155 /* unused */
0037 #define LCD_MINOR       156
0038 #define AC_MINOR        157
0039 #define BUTTON_MINOR        158 /* Major 10, Minor 158, /dev/nwbutton */
0040 #define NWFLASH_MINOR       160 /* MAJOR is 10 - miscdevice */
0041 #define ENVCTRL_MINOR       162
0042 #define I2O_MINOR       166
0043 #define UCTRL_MINOR     174
0044 #define AGPGART_MINOR       175
0045 #define TOSH_MINOR_DEV      181
0046 #define HWRNG_MINOR     183
0047 /*#define MICROCODE_MINOR   184 unused */
0048 #define KEYPAD_MINOR        185
0049 #define IRNET_MINOR     187
0050 #define D7S_MINOR       193
0051 #define VFIO_MINOR      196
0052 #define PXA3XX_GCU_MINOR    197
0053 #define TUN_MINOR       200
0054 #define CUSE_MINOR      203
0055 #define MWAVE_MINOR     219 /* ACP/Mwave Modem */
0056 #define MPT_MINOR       220
0057 #define MPT2SAS_MINOR       221
0058 #define MPT3SAS_MINOR       222
0059 #define UINPUT_MINOR        223
0060 #define MISC_MCELOG_MINOR   227
0061 #define HPET_MINOR      228
0062 #define FUSE_MINOR      229
0063 #define SNAPSHOT_MINOR      231
0064 #define KVM_MINOR       232
0065 #define BTRFS_MINOR     234
0066 #define AUTOFS_MINOR        235
0067 #define MAPPER_CTRL_MINOR   236
0068 #define LOOP_CTRL_MINOR     237
0069 #define VHOST_NET_MINOR     238
0070 #define UHID_MINOR      239
0071 #define USERIO_MINOR        240
0072 #define VHOST_VSOCK_MINOR   241
0073 #define RFKILL_MINOR        242
0074 #define MISC_DYNAMIC_MINOR  255
0075 
0076 struct device;
0077 struct attribute_group;
0078 
0079 struct miscdevice  {
0080     int minor;
0081     const char *name;
0082     const struct file_operations *fops;
0083     struct list_head list;
0084     struct device *parent;
0085     struct device *this_device;
0086     const struct attribute_group **groups;
0087     const char *nodename;
0088     umode_t mode;
0089 };
0090 
0091 extern int misc_register(struct miscdevice *misc);
0092 extern void misc_deregister(struct miscdevice *misc);
0093 
0094 /*
0095  * Helper macro for drivers that don't do anything special in the initcall.
0096  * This helps to eliminate boilerplate code.
0097  */
0098 #define builtin_misc_device(__misc_device) \
0099     builtin_driver(__misc_device, misc_register)
0100 
0101 /*
0102  * Helper macro for drivers that don't do anything special in module init / exit
0103  * call. This helps to eliminate boilerplate code.
0104  */
0105 #define module_misc_device(__misc_device) \
0106     module_driver(__misc_device, misc_register, misc_deregister)
0107 
0108 #define MODULE_ALIAS_MISCDEV(minor)             \
0109     MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR)  \
0110     "-" __stringify(minor))
0111 #endif