From ca75d601b5942e8cf5eed68f308be0526d0dac5d Mon Sep 17 00:00:00 2001 From: PrasannaKumar Muralidharan Date: Thu, 25 Aug 2016 22:30:49 +0530 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- arch/blackfin/mach-bf561/coreb.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'arch/blackfin') 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 "); MODULE_DESCRIPTION("BF561 Core B Support"); -- cgit