Commit 8670b2b8 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Greg Kroah-Hartman

rfkill: allocate static minor

udev has a feature of creating /dev/<node> device-nodes if it finds
a devnode:<node> modalias. This allows for auto-loading of modules that
provide the node. This requires to use a statically allocated minor
number for misc character devices.

However, rfkill uses dynamic minor numbers and prevents auto-loading
of the module. So allocate the next static misc minor number and use
it for rfkill.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Link: https://lore.kernel.org/r/20191024174042.19851-1-marcel@holtmann.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 82b29b9f
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#define UHID_MINOR 239 #define UHID_MINOR 239
#define USERIO_MINOR 240 #define USERIO_MINOR 240
#define VHOST_VSOCK_MINOR 241 #define VHOST_VSOCK_MINOR 241
#define RFKILL_MINOR 242
#define MISC_DYNAMIC_MINOR 255 #define MISC_DYNAMIC_MINOR 255
struct device; struct device;
......
...@@ -1316,10 +1316,12 @@ static const struct file_operations rfkill_fops = { ...@@ -1316,10 +1316,12 @@ static const struct file_operations rfkill_fops = {
.llseek = no_llseek, .llseek = no_llseek,
}; };
#define RFKILL_NAME "rfkill"
static struct miscdevice rfkill_miscdev = { static struct miscdevice rfkill_miscdev = {
.name = "rfkill",
.fops = &rfkill_fops, .fops = &rfkill_fops,
.minor = MISC_DYNAMIC_MINOR, .name = RFKILL_NAME,
.minor = RFKILL_MINOR,
}; };
static int __init rfkill_init(void) static int __init rfkill_init(void)
...@@ -1371,3 +1373,6 @@ static void __exit rfkill_exit(void) ...@@ -1371,3 +1373,6 @@ static void __exit rfkill_exit(void)
class_unregister(&rfkill_class); class_unregister(&rfkill_class);
} }
module_exit(rfkill_exit); module_exit(rfkill_exit);
MODULE_ALIAS_MISCDEV(RFKILL_MINOR);
MODULE_ALIAS("devname:" RFKILL_NAME);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment