diff options
author | PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> | 2016-08-25 22:30:49 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-31 14:12:35 +0200 |
commit | ca75d601b5942e8cf5eed68f308be0526d0dac5d (patch) | |
tree | ca411c99f5715a5976eb942a061dfa3b2b6e841d /arch | |
parent | 832c8232dd7be4977ae9fb9c7cbc4decce19a8fc (diff) | |
download | linux-ca75d601b5942e8cf5eed68f308be0526d0dac5d.tar.gz linux-ca75d601b5942e8cf5eed68f308be0526d0dac5d.tar.bz2 linux-ca75d601b5942e8cf5eed68f308be0526d0dac5d.zip |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/common/bL_switcher_dummy_if.c | 14 | ||||
-rw-r--r-- | arch/blackfin/mach-bf561/coreb.c | 13 |
2 files changed, 2 insertions, 25 deletions
diff --git a/arch/arm/common/bL_switcher_dummy_if.c b/arch/arm/common/bL_switcher_dummy_if.c index 3f47f1203c6b..6053f64c3752 100644 --- a/arch/arm/common/bL_switcher_dummy_if.c +++ b/arch/arm/common/bL_switcher_dummy_if.c @@ -56,16 +56,4 @@ static struct miscdevice bL_switcher_device = { "b.L_switcher", &bL_switcher_fops }; - -static int __init bL_switcher_dummy_if_init(void) -{ - return misc_register(&bL_switcher_device); -} - -static void __exit bL_switcher_dummy_if_exit(void) -{ - misc_deregister(&bL_switcher_device); -} - -module_init(bL_switcher_dummy_if_init); -module_exit(bL_switcher_dummy_if_exit); +module_misc_device(bL_switcher_device); diff --git a/arch/blackfin/mach-bf561/coreb.c b/arch/blackfin/mach-bf561/coreb.c index 78ecb50bafc8..8a2543c654b3 100644 --- a/arch/blackfin/mach-bf561/coreb.c +++ b/arch/blackfin/mach-bf561/coreb.c @@ -59,18 +59,7 @@ static struct miscdevice coreb_dev = { .name = "coreb", .fops = &coreb_fops, }; - -static int __init bf561_coreb_init(void) -{ - return misc_register(&coreb_dev); -} -module_init(bf561_coreb_init); - -static void __exit bf561_coreb_exit(void) -{ - misc_deregister(&coreb_dev); -} -module_exit(bf561_coreb_exit); +module_misc_device(coreb_dev); MODULE_AUTHOR("Bas Vermeulen <bvermeul@blackstar.xs4all.nl>"); MODULE_DESCRIPTION("BF561 Core B Support"); |