Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | #ifndef _LINUX_MISCDEVICE_H |
3 | #define _LINUX_MISCDEVICE_H | |
1da177e4 | 4 | #include <linux/major.h> |
1986c93f PG |
5 | #include <linux/list.h> |
6 | #include <linux/types.h> | |
ca75d601 | 7 | #include <linux/device.h> |
1da177e4 | 8 | |
79907d89 AC |
9 | /* |
10 | * These allocations are managed by device@lanana.org. If you use an | |
11 | * entry that is not in assigned your entry may well be moved and | |
12 | * reassigned, or set dynamic if a fixed value is not justified. | |
13 | */ | |
14 | ||
193da609 | 15 | #define PSMOUSE_MINOR 1 |
3503958c LDM |
16 | #define MS_BUSMOUSE_MINOR 2 /* unused */ |
17 | #define ATIXL_BUSMOUSE_MINOR 3 /* unused */ | |
193da609 | 18 | /*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */ |
3503958c LDM |
19 | #define ATARIMOUSE_MINOR 5 /* unused */ |
20 | #define SUN_MOUSE_MINOR 6 /* unused */ | |
21 | #define APOLLO_MOUSE_MINOR 7 /* unused */ | |
22 | #define PC110PAD_MINOR 9 /* unused */ | |
193da609 | 23 | /*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */ |
1da177e4 LT |
24 | #define WATCHDOG_MINOR 130 /* Watchdog timer */ |
25 | #define TEMP_MINOR 131 /* Temperature Sensor */ | |
874bcd00 | 26 | #define APM_MINOR_DEV 134 |
193da609 | 27 | #define RTC_MINOR 135 |
1da177e4 | 28 | #define EFI_RTC_MINOR 136 /* EFI Time services */ |
b075dd40 | 29 | #define VHCI_MINOR 137 |
193da609 | 30 | #define SUN_OPENPROM_MINOR 139 |
3503958c | 31 | #define DMAPI_MINOR 140 /* unused */ |
193da609 TH |
32 | #define NVRAM_MINOR 144 |
33 | #define SGI_MMTIMER 153 | |
3503958c | 34 | #define STORE_QUEUE_MINOR 155 /* unused */ |
193da609 | 35 | #define I2O_MINOR 166 |
fd50d71f | 36 | #define HWRNG_MINOR 183 |
1da177e4 | 37 | #define MICROCODE_MINOR 184 |
24c946cc | 38 | #define IRNET_MINOR 187 |
8dcf94bc | 39 | #define VFIO_MINOR 196 |
193da609 | 40 | #define TUN_MINOR 200 |
cb2ffb26 | 41 | #define CUSE_MINOR 203 |
193da609 TH |
42 | #define MWAVE_MINOR 219 /* ACP/Mwave Modem */ |
43 | #define MPT_MINOR 220 | |
dec3f959 | 44 | #define MPT2SAS_MINOR 221 |
78ad724a | 45 | #define MPT3SAS_MINOR 222 |
8905aaaf | 46 | #define UINPUT_MINOR 223 |
cef12ee5 | 47 | #define MISC_MCELOG_MINOR 227 |
193da609 TH |
48 | #define HPET_MINOR 228 |
49 | #define FUSE_MINOR 229 | |
50 | #define KVM_MINOR 232 | |
578454ff KS |
51 | #define BTRFS_MINOR 234 |
52 | #define AUTOFS_MINOR 235 | |
7e507eb6 | 53 | #define MAPPER_CTRL_MINOR 236 |
770fe30a | 54 | #define LOOP_CTRL_MINOR 237 |
7c7c7f01 | 55 | #define VHOST_NET_MINOR 238 |
19872d20 | 56 | #define UHID_MINOR 239 |
5523662e | 57 | #define USERIO_MINOR 240 |
f4660cc9 | 58 | #define VHOST_VSOCK_MINOR 241 |
193da609 | 59 | #define MISC_DYNAMIC_MINOR 255 |
1da177e4 LT |
60 | |
61 | struct device; | |
bd735995 | 62 | struct attribute_group; |
1da177e4 LT |
63 | |
64 | struct miscdevice { | |
65 | int minor; | |
66 | const char *name; | |
99ac48f5 | 67 | const struct file_operations *fops; |
1da177e4 | 68 | struct list_head list; |
94fbcded GKH |
69 | struct device *parent; |
70 | struct device *this_device; | |
bd735995 | 71 | const struct attribute_group **groups; |
e454cea2 | 72 | const char *nodename; |
a85cfdae | 73 | umode_t mode; |
1da177e4 LT |
74 | }; |
75 | ||
f82dd4b0 | 76 | extern int misc_register(struct miscdevice *misc); |
f368ed60 | 77 | extern void misc_deregister(struct miscdevice *misc); |
1da177e4 | 78 | |
f71082f8 PG |
79 | /* |
80 | * Helper macro for drivers that don't do anything special in the initcall. | |
81 | * This helps in eleminating of boilerplate code. | |
82 | */ | |
83 | #define builtin_misc_device(__misc_device) \ | |
84 | builtin_driver(__misc_device, misc_register) | |
85 | ||
ca75d601 PM |
86 | /* |
87 | * Helper macro for drivers that don't do anything special in module init / exit | |
88 | * call. This helps in eleminating of boilerplate code. | |
89 | */ | |
90 | #define module_misc_device(__misc_device) \ | |
91 | module_driver(__misc_device, misc_register, misc_deregister) | |
92 | ||
1da177e4 LT |
93 | #define MODULE_ALIAS_MISCDEV(minor) \ |
94 | MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \ | |
95 | "-" __stringify(minor)) | |
96 | #endif |