linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: fsl-ftm-alarm: Use module_init and add module_exit
@ 2022-08-26  7:00 Zhang Jianhua
  2022-08-26  7:22 ` Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Jianhua @ 2022-08-26  7:00 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni; +Cc: chris.zjh, linux-rtc, linux-kernel

- Use module_init instead of device_initcall.
- Add a function for module_exit to unregister driver.

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

diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c
index c0df49fb978c..28bdc6c97b64 100644
--- a/drivers/rtc/rtc-fsl-ftm-alarm.c
+++ b/drivers/rtc/rtc-fsl-ftm-alarm.c
@@ -332,7 +332,13 @@ static int __init ftm_alarm_init(void)
 	return platform_driver_register(&ftm_rtc_driver);
 }
 
-device_initcall(ftm_alarm_init);
+static void __exit ftm_alarm_exit(void)
+{
+	platform_driver_unregister(&ftm_rtc_driver);
+}
+
+module_init(ftm_alarm_init)
+module_exit(ftm_alarm_exit)
 
 MODULE_DESCRIPTION("NXP/Freescale FlexTimer alarm driver");
 MODULE_AUTHOR("Biwen Li <biwen.li@nxp.com>");
-- 
2.31.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: fsl-ftm-alarm: Use module_init and add module_exit
  2022-08-26  7:00 [PATCH] rtc: fsl-ftm-alarm: Use module_init and add module_exit Zhang Jianhua
@ 2022-08-26  7:22 ` Alexandre Belloni
  2022-08-26  7:45   ` zhangjianhua (E)
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2022-08-26  7:22 UTC (permalink / raw)
  To: Zhang Jianhua; +Cc: a.zummo, linux-rtc, linux-kernel

On 26/08/2022 15:00:17+0800, Zhang Jianhua wrote:
> - Use module_init instead of device_initcall.
> - Add a function for module_exit to unregister driver.
> 

I can see what you are doing but this doesn't explain why. Also, was
this tested on any actual hardware?

> Signed-off-by: Zhang Jianhua <chris.zjh@huawei.com>
> ---
>  drivers/rtc/rtc-fsl-ftm-alarm.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c
> index c0df49fb978c..28bdc6c97b64 100644
> --- a/drivers/rtc/rtc-fsl-ftm-alarm.c
> +++ b/drivers/rtc/rtc-fsl-ftm-alarm.c
> @@ -332,7 +332,13 @@ static int __init ftm_alarm_init(void)
>  	return platform_driver_register(&ftm_rtc_driver);
>  }
>  
> -device_initcall(ftm_alarm_init);
> +static void __exit ftm_alarm_exit(void)
> +{
> +	platform_driver_unregister(&ftm_rtc_driver);
> +}
> +
> +module_init(ftm_alarm_init)
> +module_exit(ftm_alarm_exit)
>  
>  MODULE_DESCRIPTION("NXP/Freescale FlexTimer alarm driver");
>  MODULE_AUTHOR("Biwen Li <biwen.li@nxp.com>");
> -- 
> 2.31.0
> 

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: fsl-ftm-alarm: Use module_init and add module_exit
  2022-08-26  7:22 ` Alexandre Belloni
@ 2022-08-26  7:45   ` zhangjianhua (E)
  0 siblings, 0 replies; 3+ messages in thread
From: zhangjianhua (E) @ 2022-08-26  7:45 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: a.zummo, linux-rtc, linux-kernel


在 2022/8/26 15:22, Alexandre Belloni 写道:
> On 26/08/2022 15:00:17+0800, Zhang Jianhua wrote:
>> - Use module_init instead of device_initcall.
>> - Add a function for module_exit to unregister driver.
>>
> I can see what you are doing but this doesn't explain why. Also, was
> this tested on any actual hardware?

I find this problem by code review, so solve it smoothly, and there is 
no hardware, so I just test it on qemu.

May I need to modify the commit message?

>> Signed-off-by: Zhang Jianhua <chris.zjh@huawei.com>
>> ---
>>   drivers/rtc/rtc-fsl-ftm-alarm.c | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c
>> index c0df49fb978c..28bdc6c97b64 100644
>> --- a/drivers/rtc/rtc-fsl-ftm-alarm.c
>> +++ b/drivers/rtc/rtc-fsl-ftm-alarm.c
>> @@ -332,7 +332,13 @@ static int __init ftm_alarm_init(void)
>>   	return platform_driver_register(&ftm_rtc_driver);
>>   }
>>   
>> -device_initcall(ftm_alarm_init);
>> +static void __exit ftm_alarm_exit(void)
>> +{
>> +	platform_driver_unregister(&ftm_rtc_driver);
>> +}
>> +
>> +module_init(ftm_alarm_init)
>> +module_exit(ftm_alarm_exit)
>>   
>>   MODULE_DESCRIPTION("NXP/Freescale FlexTimer alarm driver");
>>   MODULE_AUTHOR("Biwen Li <biwen.li@nxp.com>");
>> -- 
>> 2.31.0
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-26  7:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26  7:00 [PATCH] rtc: fsl-ftm-alarm: Use module_init and add module_exit Zhang Jianhua
2022-08-26  7:22 ` Alexandre Belloni
2022-08-26  7:45   ` zhangjianhua (E)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).