[PATCH -next] rtc: fsl-ftm-alarm: Use module_platform_driver replace device_initcall

Zhang Jianhua posted 1 patch 3 years, 7 months ago
drivers/rtc/rtc-fsl-ftm-alarm.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
[PATCH -next] rtc: fsl-ftm-alarm: Use module_platform_driver replace device_initcall
Posted by Zhang Jianhua 3 years, 7 months ago
The ftm_rtc_driver has been registered while module init, however there
is not unregister step for module exit, now use the macro
module_platform_driver replace device_initcall, which can register and
unregister platform driver automatically.

Signed-off-by: Zhang Jianhua <chris.zjh@huawei.com>
---
 drivers/rtc/rtc-fsl-ftm-alarm.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c
index c0df49fb978c..3d7c4077fe1c 100644
--- a/drivers/rtc/rtc-fsl-ftm-alarm.c
+++ b/drivers/rtc/rtc-fsl-ftm-alarm.c
@@ -327,12 +327,7 @@ static struct platform_driver ftm_rtc_driver = {
 	},
 };
 
-static int __init ftm_alarm_init(void)
-{
-	return platform_driver_register(&ftm_rtc_driver);
-}
-
-device_initcall(ftm_alarm_init);
+module_platform_driver(ftm_rtc_driver);
 
 MODULE_DESCRIPTION("NXP/Freescale FlexTimer alarm driver");
 MODULE_AUTHOR("Biwen Li <biwen.li@nxp.com>");
-- 
2.31.0
Re: [PATCH -next] rtc: fsl-ftm-alarm: Use module_platform_driver replace device_initcall
Posted by Alexandre Belloni 3 years, 4 months ago
On Tue, 6 Sep 2022 22:30:37 +0800, Zhang Jianhua wrote:
> The ftm_rtc_driver has been registered while module init, however there
> is not unregister step for module exit, now use the macro
> module_platform_driver replace device_initcall, which can register and
> unregister platform driver automatically.
> 
> 

Applied, thanks!

[1/1] rtc: fsl-ftm-alarm: Use module_platform_driver replace device_initcall
      commit: 775f42aaf61a4a2ee09a196d8c7d271ef3ba779b

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com