Patchwork RTC: rtc-ab3100 - Add missing platform_set_drvdata() in ab3100_rtc_probe()

login
register
mail settings
Submitter Axel Lin
Date Sept. 19, 2010, 10:22 a.m.
Message ID <1284891726.2199.3.camel@phoenix>
Download mbox | patch
Permalink /patch/65154/
State New
Headers show

Comments

Axel Lin - Sept. 19, 2010, 10:22 a.m.
Otherwise, calling platform_get_drvdata() in ab3100_rtc_remove() return NULL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/rtc/rtc-ab3100.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Wan ZongShun - Sept. 20, 2010, 2 a.m.
Hi Axel ,

2010/9/19 Axel Lin <axel.lin@gmail.com>:
> Otherwise, calling platform_get_drvdata() in ab3100_rtc_remove() return NULL.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by:Wan ZongShun <mcuos.com@gmail.com>

> ---
>  drivers/rtc/rtc-ab3100.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c
> index d26780e..261a07e 100644
> --- a/drivers/rtc/rtc-ab3100.c
> +++ b/drivers/rtc/rtc-ab3100.c
> @@ -235,6 +235,7 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev)
>                err = PTR_ERR(rtc);
>                return err;
>        }
> +       platform_set_drvdata(pdev, rtc);
>
>        return 0;
>  }
> @@ -244,6 +245,7 @@ static int __exit ab3100_rtc_remove(struct platform_device *pdev)
>        struct rtc_device *rtc = platform_get_drvdata(pdev);
>
>        rtc_device_unregister(rtc);
> +       platform_set_drvdata(pdev, NULL);
>        return 0;
>  }
>
> --
> 1.7.0.4
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
Linus Walleij - Sept. 20, 2010, 9:29 a.m.
Axel Lin wrote:

> Otherwise, calling platform_get_drvdata() in ab3100_rtc_remove() return NULL.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Ah thanks!

Acked-by: Linus Walleij <linus.walleij@stericsson.com>

Yours,
Linus Walleij

Patch

diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c
index d26780e..261a07e 100644
--- a/drivers/rtc/rtc-ab3100.c
+++ b/drivers/rtc/rtc-ab3100.c
@@ -235,6 +235,7 @@  static int __init ab3100_rtc_probe(struct platform_device *pdev)
 		err = PTR_ERR(rtc);
 		return err;
 	}
+	platform_set_drvdata(pdev, rtc);
 
 	return 0;
 }
@@ -244,6 +245,7 @@  static int __exit ab3100_rtc_remove(struct platform_device *pdev)
 	struct rtc_device *rtc = platform_get_drvdata(pdev);
 
 	rtc_device_unregister(rtc);
+	platform_set_drvdata(pdev, NULL);
 	return 0;
 }