Using devm_rtc_device_register() helper to simplify code.

Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Chen-Yu Tsai <[email protected]>
Signed-off-by: Kefeng Wang <[email protected]>
---
 drivers/rtc/rtc-sunxi.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c
index abada60..6fba5ae 100644
--- a/drivers/rtc/rtc-sunxi.c
+++ b/drivers/rtc/rtc-sunxi.c
@@ -481,8 +481,8 @@ static int sunxi_rtc_probe(struct platform_device *pdev)
        writel(SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND, chip->base +
                        SUNXI_ALRM_IRQ_STA);
 
-       chip->rtc = rtc_device_register("rtc-sunxi", &pdev->dev,
-                       &sunxi_rtc_ops, THIS_MODULE);
+       chip->rtc = devm_rtc_device_register(&pdev->dev, "rtc-sunxi",
+                                            &sunxi_rtc_ops, THIS_MODULE);
        if (IS_ERR(chip->rtc)) {
                dev_err(&pdev->dev, "unable to register device\n");
                return PTR_ERR(chip->rtc);
@@ -493,18 +493,8 @@ static int sunxi_rtc_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int sunxi_rtc_remove(struct platform_device *pdev)
-{
-       struct sunxi_rtc_dev *chip = platform_get_drvdata(pdev);
-
-       rtc_device_unregister(chip->rtc);
-
-       return 0;
-}
-
 static struct platform_driver sunxi_rtc_driver = {
        .probe          = sunxi_rtc_probe,
-       .remove         = sunxi_rtc_remove,
        .driver         = {
                .name           = "sunxi-rtc",
                .of_match_table = sunxi_rtc_dt_ids,
-- 
1.7.12.4

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups 
"rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to