mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
miscdevice: Add helper macro for misc device boilerplate
Many modules call misc_register and misc_deregister in its module init and exit methods without any additional code. This ends up being boilerplate. This patch adds helper macro module_misc_device(), that replaces module_init()/ module_exit() with template functions. This patch also converts drivers to use new macro. Change since v1: Add device.h include in miscdevice.h as module_driver macro was not available from other include files in some architectures. Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
832c8232dd
commit
ca75d601b5
7 changed files with 15 additions and 80 deletions
|
@ -1013,23 +1013,12 @@ static struct miscdevice uinput_misc = {
|
|||
.minor = UINPUT_MINOR,
|
||||
.name = UINPUT_NAME,
|
||||
};
|
||||
module_misc_device(uinput_misc);
|
||||
|
||||
MODULE_ALIAS_MISCDEV(UINPUT_MINOR);
|
||||
MODULE_ALIAS("devname:" UINPUT_NAME);
|
||||
|
||||
static int __init uinput_init(void)
|
||||
{
|
||||
return misc_register(&uinput_misc);
|
||||
}
|
||||
|
||||
static void __exit uinput_exit(void)
|
||||
{
|
||||
misc_deregister(&uinput_misc);
|
||||
}
|
||||
|
||||
MODULE_AUTHOR("Aristeu Sergio Rozanski Filho");
|
||||
MODULE_DESCRIPTION("User level driver support for input subsystem");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION("0.3");
|
||||
|
||||
module_init(uinput_init);
|
||||
module_exit(uinput_exit);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue