diff options
| author | Andrew Morton <akpm@osdl.org> | 2003-09-03 11:13:04 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-09-03 11:13:04 -0700 |
| commit | 95759639ef09fc2439cd092cb8ee6e067aac6220 (patch) | |
| tree | 1974288379eb8abeea839216e0ba0baf3be32d33 /include/linux | |
| parent | e46674c847e156b1d4f485120a3d92fcaa5ce6e5 (diff) | |
[PATCH] MODULE_ALIAS() in char devices
From: Rusty Russell <rusty@rustcorp.com.au>
Previously, default aliases were hardwired into modutils. Now they should
be inside the modules, using MODULE_ALIAS() (they will be overridden by any
user alias).
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/device.h | 5 | ||||
| -rw-r--r-- | include/linux/miscdevice.h | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 8d6266f2e3c3..96043c0f46c5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -398,4 +398,9 @@ extern void firmware_unregister(struct subsystem *); #define dev_warn(dev, format, arg...) \ dev_printk(KERN_WARNING , dev , format , ## arg) +/* Create alias, so I can be autoloaded. */ +#define MODULE_ALIAS_CHARDEV(major,minor) \ + MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) +#define MODULE_ALIAS_CHARDEV_MAJOR(major) \ + MODULE_ALIAS("char-major-" __stringify(major) "-*") #endif /* _DEVICE_H_ */ diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 159f8ab3df80..23b095889111 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -1,5 +1,7 @@ #ifndef _LINUX_MISCDEVICE_H #define _LINUX_MISCDEVICE_H +#include <linux/module.h> +#include <linux/major.h> #define BUSMOUSE_MINOR 0 #define PSMOUSE_MINOR 1 @@ -48,4 +50,7 @@ struct miscdevice extern int misc_register(struct miscdevice * misc); extern int misc_deregister(struct miscdevice * misc); +#define MODULE_ALIAS_MISCDEV(minor) \ + MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \ + "-" __stringify(minor)) #endif |
