Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: ds1685: Use module_platform_driver

Use module_platform_driver for drivers whose init and exit functions
only register and unregister, respectively.

A simplified version of the Coccinelle semantic patch that performs
this transformation is as follows:

@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: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

authored by

Vaishali Thakkar and committed by
Alexandre Belloni
508db592 7abea617

+1 -21
+1 -21
drivers/rtc/rtc-ds1685.c
··· 2145 2145 .probe = ds1685_rtc_probe, 2146 2146 .remove = ds1685_rtc_remove, 2147 2147 }; 2148 - 2149 - /** 2150 - * ds1685_rtc_init - rtc module init. 2151 - */ 2152 - static int __init 2153 - ds1685_rtc_init(void) 2154 - { 2155 - return platform_driver_register(&ds1685_rtc_driver); 2156 - } 2157 - 2158 - /** 2159 - * ds1685_rtc_exit - rtc module exit. 2160 - */ 2161 - static void __exit 2162 - ds1685_rtc_exit(void) 2163 - { 2164 - platform_driver_unregister(&ds1685_rtc_driver); 2165 - } 2166 - 2167 - module_init(ds1685_rtc_init); 2168 - module_exit(ds1685_rtc_exit); 2148 + module_platform_driver(ds1685_rtc_driver); 2169 2149 /* ----------------------------------------------------------------------- */ 2170 2150 2171 2151