Skip to content

Commit dde74a5

Browse files
Uwe Kleine-Königsre
authored andcommitted
power: reset: at91-sama5d2_shdwc: 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 so 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 __ref which is needed to suppress a (W=1) modpost warning. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Link: https://lore.kernel.org/r/20231104211501.3676352-19-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 12389c6 commit dde74a5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

drivers/power/reset/at91-sama5d2_shdwc.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static const struct of_device_id at91_pmc_ids[] = {
329329
{ /* Sentinel. */ }
330330
};
331331

332-
static int __init at91_shdwc_probe(struct platform_device *pdev)
332+
static int at91_shdwc_probe(struct platform_device *pdev)
333333
{
334334
const struct of_device_id *match;
335335
struct device_node *np;
@@ -421,7 +421,7 @@ static int __init at91_shdwc_probe(struct platform_device *pdev)
421421
return ret;
422422
}
423423

424-
static int __exit at91_shdwc_remove(struct platform_device *pdev)
424+
static int at91_shdwc_remove(struct platform_device *pdev)
425425
{
426426
struct shdwc *shdw = platform_get_drvdata(pdev);
427427

@@ -442,13 +442,14 @@ static int __exit at91_shdwc_remove(struct platform_device *pdev)
442442
}
443443

444444
static struct platform_driver at91_shdwc_driver = {
445-
.remove = __exit_p(at91_shdwc_remove),
445+
.probe = at91_shdwc_probe,
446+
.remove = at91_shdwc_remove,
446447
.driver = {
447448
.name = "at91-shdwc",
448449
.of_match_table = at91_shdwc_of_match,
449450
},
450451
};
451-
module_platform_driver_probe(at91_shdwc_driver, at91_shdwc_probe);
452+
module_platform_driver(at91_shdwc_driver);
452453

453454
MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>");
454455
MODULE_DESCRIPTION("Atmel shutdown controller driver");

0 commit comments

Comments
 (0)