Skip to content

Commit 86aa291

Browse files
Uwe Kleine-KönigWim Van Sebroeck
authored andcommitted
watchdog: at91sam9: Stop using module_platform_driver_probe()
On today's platforms the benefit of platform_driver_probe() isn't that relevant any more. It allows to drop some code after booting (or module loading) for .probe() and discard the .remove() function completely if the driver is built-in. This typically saves a few 100k. The downside of platform_driver_probe() is that the driver cannot be bound and unbound at runtime which is ancient and also slightly complicates testing. There are also thoughts to deprecate platform_driver_probe() because it adds some complexity in the driver core for little gain. Also many drivers don't use it correctly. This driver for example misses to mark the driver struct with __refdata which is needed to suppress a (W=1) modpost warning: WARNING: modpost: drivers/watchdog/at91sam9_wdt: section mismatch in reference: at91wdt_driver+0x4 (section: .data) -> at91wdt_remove (section: .exit.text) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231106154807.3866712-2-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
1 parent dc805ea commit 86aa291

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/watchdog/at91sam9_wdt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static inline int of_at91wdt_init(struct device_node *np, struct at91wdt *wdt)
324324
}
325325
#endif
326326

327-
static int __init at91wdt_probe(struct platform_device *pdev)
327+
static int at91wdt_probe(struct platform_device *pdev)
328328
{
329329
int err;
330330
struct at91wdt *wdt;
@@ -372,7 +372,7 @@ static int __init at91wdt_probe(struct platform_device *pdev)
372372
return 0;
373373
}
374374

375-
static int __exit at91wdt_remove(struct platform_device *pdev)
375+
static int at91wdt_remove(struct platform_device *pdev)
376376
{
377377
struct at91wdt *wdt = platform_get_drvdata(pdev);
378378
watchdog_unregister_device(&wdt->wdd);
@@ -393,14 +393,14 @@ MODULE_DEVICE_TABLE(of, at91_wdt_dt_ids);
393393
#endif
394394

395395
static struct platform_driver at91wdt_driver = {
396-
.remove = __exit_p(at91wdt_remove),
396+
.probe = at91wdt_probe,
397+
.remove = at91wdt_remove,
397398
.driver = {
398399
.name = "at91_wdt",
399400
.of_match_table = of_match_ptr(at91_wdt_dt_ids),
400401
},
401402
};
402-
403-
module_platform_driver_probe(at91wdt_driver, at91wdt_probe);
403+
module_platform_driver(at91wdt_driver);
404404

405405
MODULE_AUTHOR("Renaud CERRATO <r.cerrato@til-technologies.fr>");
406406
MODULE_DESCRIPTION("Watchdog driver for Atmel AT91SAM9x processors");

0 commit comments

Comments
 (0)