From: Shraddha Barke Date: Sat, 3 Oct 2015 12:01:30 +0000 (+0530) Subject: Staging: most: Use module_platform_driver X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8668984f8129d5ac7a90c6c0348e8ed4207fc145;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Staging: most: Use module_platform_driver Use module_platform_driver for drivers whose init and exit functions only register and unregister, respectively. Thus remove some boilerplate code. A simplified version of Coccinelle patch - @a@ identifier f, x; @@ -static f(...) { return platform_driver_register(&x); } @b depends on a@ identifier e, a.x; @@ -static e(...) { platform_driver_unregister(&x); } @c depends on a && b@ identifier a.f; declarer name module_init; @@ -module_init(f); @d depends on a && b && c@ identifier b.e, a.x; declarer name module_exit; declarer name module_platform_driver; @@ -module_exit(e); +module_platform_driver(x); Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 1bb70b738155..c7e956f5fec0 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -926,26 +926,7 @@ static struct platform_driver dim2_driver = { }, }; -/** - * dim2_hdm_init - Driver Registration Routine - */ -static int __init dim2_hdm_init(void) -{ - pr_info("dim2_hdm_init()\n"); - return platform_driver_register(&dim2_driver); -} - -/** - * dim2_hdm_exit - Driver Cleanup Routine - **/ -static void __exit dim2_hdm_exit(void) -{ - pr_info("dim2_hdm_exit()\n"); - platform_driver_unregister(&dim2_driver); -} - -module_init(dim2_hdm_init); -module_exit(dim2_hdm_exit); +module_platform_driver(dim2_driver); MODULE_AUTHOR("Jain Roy Ambi "); MODULE_AUTHOR("Andrey Shvetsov ");