rtc: rtc-tps6586x: use devm_rtc_device_register()
authorJingoo Han <jg1.han@samsung.com>
Mon, 29 Apr 2013 23:19:15 +0000 (16:19 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Apr 2013 01:28:27 +0000 (18:28 -0700)
devm_rtc_device_register() is device managed and makes cleanup
paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-tps6586x.c

index aab4e8c936226244b25f112a52a86c0a84c67a9c..b6aab9f80f737ae95d744e8e1f215e960ac49142 100644 (file)
@@ -274,7 +274,7 @@ static int tps6586x_rtc_probe(struct platform_device *pdev)
        }
 
        platform_set_drvdata(pdev, rtc);
-       rtc->rtc = rtc_device_register(dev_name(&pdev->dev), &pdev->dev,
+       rtc->rtc = devm_rtc_device_register(&pdev->dev, dev_name(&pdev->dev),
                                       &tps6586x_rtc_ops, THIS_MODULE);
        if (IS_ERR(rtc->rtc)) {
                ret = PTR_ERR(rtc->rtc);
@@ -306,12 +306,10 @@ fail_rtc_register:
 
 static int tps6586x_rtc_remove(struct platform_device *pdev)
 {
-       struct tps6586x_rtc *rtc = platform_get_drvdata(pdev);
        struct device *tps_dev = to_tps6586x_dev(&pdev->dev);
 
        tps6586x_update(tps_dev, RTC_CTRL, 0,
                RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK);
-       rtc_device_unregister(rtc->rtc);
        return 0;
 }