summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-09-03 11:13:04 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-09-03 11:13:04 -0700
commit95759639ef09fc2439cd092cb8ee6e067aac6220 (patch)
tree1974288379eb8abeea839216e0ba0baf3be32d33 /include/linux
parente46674c847e156b1d4f485120a3d92fcaa5ce6e5 (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.h5
-rw-r--r--include/linux/miscdevice.h5
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