Commit 95759639 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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).
parent e46674c8
...@@ -2080,4 +2080,4 @@ MODULE_PARM_DESC(idle_period, ...@@ -2080,4 +2080,4 @@ MODULE_PARM_DESC(idle_period,
MODULE_PARM(smp, "i"); MODULE_PARM(smp, "i");
MODULE_PARM_DESC(smp, MODULE_PARM_DESC(smp,
"Set this to enable APM use on an SMP platform. Use with caution on older systems"); "Set this to enable APM use on an SMP platform. Use with caution on older systems");
MODULE_ALIAS_MISCDEV(APM_MINOR_DEV);
...@@ -331,6 +331,7 @@ __setup("agp=", agp_setup); ...@@ -331,6 +331,7 @@ __setup("agp=", agp_setup);
MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>"); MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>");
MODULE_DESCRIPTION("AGP GART driver"); MODULE_DESCRIPTION("AGP GART driver");
MODULE_LICENSE("GPL and additional rights"); MODULE_LICENSE("GPL and additional rights");
MODULE_ALIAS_MISCDEV(AGPGART_MINOR);
module_init(agp_init); module_init(agp_init);
module_exit(agp_exit); module_exit(agp_exit);
......
...@@ -1097,4 +1097,3 @@ void agp_frontend_cleanup(void) ...@@ -1097,4 +1097,3 @@ void agp_frontend_cleanup(void)
{ {
misc_deregister(&agp_miscdev); misc_deregister(&agp_miscdev);
} }
...@@ -452,4 +452,5 @@ EXPORT_SYMBOL(busmouse_add_buttons); ...@@ -452,4 +452,5 @@ EXPORT_SYMBOL(busmouse_add_buttons);
EXPORT_SYMBOL(register_busmouse); EXPORT_SYMBOL(register_busmouse);
EXPORT_SYMBOL(unregister_busmouse); EXPORT_SYMBOL(unregister_busmouse);
MODULE_ALIAS_MISCDEV(BUSMOUSE_MINOR);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -965,4 +965,5 @@ __setup("lp=", lp_setup); ...@@ -965,4 +965,5 @@ __setup("lp=", lp_setup);
module_init(lp_init_module); module_init(lp_init_module);
module_exit(lp_cleanup_module); module_exit(lp_cleanup_module);
MODULE_ALIAS("char-major-" __stringify(LP_MAJOR));
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -923,3 +923,4 @@ EXPORT_SYMBOL(__nvram_check_checksum); ...@@ -923,3 +923,4 @@ EXPORT_SYMBOL(__nvram_check_checksum);
EXPORT_SYMBOL(nvram_check_checksum); EXPORT_SYMBOL(nvram_check_checksum);
EXPORT_SYMBOL(__nvram_set_checksum); EXPORT_SYMBOL(__nvram_set_checksum);
EXPORT_SYMBOL(nvram_set_checksum); EXPORT_SYMBOL(nvram_set_checksum);
MODULE_ALIAS_MISCDEV(NVRAM_MINOR);
...@@ -1345,3 +1345,4 @@ static void set_rtc_irq_bit(unsigned char bit) ...@@ -1345,3 +1345,4 @@ static void set_rtc_irq_bit(unsigned char bit)
MODULE_AUTHOR("Paul Gortmaker"); MODULE_AUTHOR("Paul Gortmaker");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(RTC_MINOR);
...@@ -579,4 +579,6 @@ module_exit(wdt_exit); ...@@ -579,4 +579,6 @@ module_exit(wdt_exit);
MODULE_AUTHOR("Alan Cox"); MODULE_AUTHOR("Alan Cox");
MODULE_DESCRIPTION("Driver for ISA ICS watchdog cards (WDT500/501)"); MODULE_DESCRIPTION("Driver for ISA ICS watchdog cards (WDT500/501)");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
MODULE_ALIAS_MISCDEV(TEMP_MINOR);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -115,6 +115,7 @@ MODULE_PARM(v4l2,"i"); ...@@ -115,6 +115,7 @@ MODULE_PARM(v4l2,"i");
MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards");
MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS_CHARDEV_MAJOR(VIDEO_MAJOR);
/* kernel args */ /* kernel args */
#ifndef MODULE #ifndef MODULE
......
...@@ -2670,3 +2670,4 @@ EXPORT_SYMBOL(ppp_unregister_compressor); ...@@ -2670,3 +2670,4 @@ EXPORT_SYMBOL(ppp_unregister_compressor);
EXPORT_SYMBOL(all_ppp_units); /* for debugging */ EXPORT_SYMBOL(all_ppp_units); /* for debugging */
EXPORT_SYMBOL(all_channels); /* for debugging */ EXPORT_SYMBOL(all_channels); /* for debugging */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS_CHARDEV_MAJOR(PPP_MAJOR);
...@@ -640,3 +640,4 @@ void tun_cleanup(void) ...@@ -640,3 +640,4 @@ void tun_cleanup(void)
module_init(tun_init); module_init(tun_init);
module_exit(tun_cleanup); module_exit(tun_cleanup);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(TUN_MINOR);
...@@ -398,4 +398,9 @@ extern void firmware_unregister(struct subsystem *); ...@@ -398,4 +398,9 @@ extern void firmware_unregister(struct subsystem *);
#define dev_warn(dev, format, arg...) \ #define dev_warn(dev, format, arg...) \
dev_printk(KERN_WARNING , 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_ */ #endif /* _DEVICE_H_ */
#ifndef _LINUX_MISCDEVICE_H #ifndef _LINUX_MISCDEVICE_H
#define _LINUX_MISCDEVICE_H #define _LINUX_MISCDEVICE_H
#include <linux/module.h>
#include <linux/major.h>
#define BUSMOUSE_MINOR 0 #define BUSMOUSE_MINOR 0
#define PSMOUSE_MINOR 1 #define PSMOUSE_MINOR 1
...@@ -48,4 +50,7 @@ struct miscdevice ...@@ -48,4 +50,7 @@ struct miscdevice
extern int misc_register(struct miscdevice * misc); extern int misc_register(struct miscdevice * misc);
extern int misc_deregister(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 #endif
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