Patchwork rtc: rtc-tile: add missing platform_device_unregister() when module exit

login
register
mail settings
Submitter Wei Yongjun
Date May 5, 2013, 5:07 a.m.
Message ID <CAPgLHd86cg11pHka0TRMFkEJV2ETLHwnr3oUo=FpBYnSLk=8sA@mail.gmail.com>
Download mbox | patch
Permalink /patch/241502/
State New
Headers show

Comments

Wei Yongjun - May 5, 2013, 5:07 a.m.
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

We have registered platform device when module init, and
need unregister it when module exit.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/rtc/rtc-tile.c | 1 +
 1 file changed, 1 insertion(+)
Andrew Morton - May 7, 2013, 11:28 p.m.
On Sun, 5 May 2013 13:07:00 +0800 Wei Yongjun <weiyj.lk@gmail.com> wrote:

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> We have registered platform device when module init, and
> need unregister it when module exit.
> 
> ...
>
> --- a/drivers/rtc/rtc-tile.c
> +++ b/drivers/rtc/rtc-tile.c
> @@ -146,6 +146,7 @@ exit_driver_unregister:
>   */
>  static void __exit tile_rtc_driver_exit(void)
>  {
> +	platform_device_unregister(tile_rtc_platform_device);
>  	platform_driver_unregister(&tile_rtc_platform_driver);
>  }

We don't need to do a platform_device_put(), as tile_rtc_driver_init()
does?

drivers/rtc/rtc-stmp3xxx.c appears to need the same fix.
Wei Yongjun - May 8, 2013, 2:46 a.m.
On 05/08/2013 07:28 AM, Andrew Morton wrote:
> On Sun, 5 May 2013 13:07:00 +0800 Wei Yongjun <weiyj.lk@gmail.com> wrote:
>
>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>>
>> We have registered platform device when module init, and
>> need unregister it when module exit.
>>
>> ...
>>
>> --- a/drivers/rtc/rtc-tile.c
>> +++ b/drivers/rtc/rtc-tile.c
>> @@ -146,6 +146,7 @@ exit_driver_unregister:
>>   */
>>  static void __exit tile_rtc_driver_exit(void)
>>  {
>> +	platform_device_unregister(tile_rtc_platform_device);
>>  	platform_driver_unregister(&tile_rtc_platform_driver);
>>  }
> We don't need to do a platform_device_put(), as tile_rtc_driver_init()
> does?

platform_device_unregister() is a warp of platform_device_del() and
platform_device_put(), it is used after platform_device_add() success.
So extra platform_device_put() does not need.
 

> drivers/rtc/rtc-stmp3xxx.c appears to need the same fix.

Yes, you are right. I'll try to submit another patch to fix this unless
someone beats me at it.


>
>   
>
>
Chris Metcalf - May 8, 2013, 6:01 p.m.
On 5/5/2013 1:07 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> We have registered platform device when module init, and
> need unregister it when module exit.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/rtc/rtc-tile.c | 1 +
>  1 file changed, 1 insertion(+)

Thanks.  Taken into the tile tree.

Patch

diff --git a/drivers/rtc/rtc-tile.c b/drivers/rtc/rtc-tile.c
index 249b653..fc3dee9 100644
--- a/drivers/rtc/rtc-tile.c
+++ b/drivers/rtc/rtc-tile.c
@@ -146,6 +146,7 @@  exit_driver_unregister:
  */
 static void __exit tile_rtc_driver_exit(void)
 {
+	platform_device_unregister(tile_rtc_platform_device);
 	platform_driver_unregister(&tile_rtc_platform_driver);
 }