Commit e38d161f authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: ftrtc010: switch to devm_rtc_allocate_device

Switch to devm_rtc_allocate_device/rtc_register_device. This allow or
further improvement and simplifies ftrtc010_rtc_remove().
Acked-by: default avatarHans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 32b41f93
...@@ -166,14 +166,18 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev) ...@@ -166,14 +166,18 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
if (!rtc->rtc_base) if (!rtc->rtc_base)
return -ENOMEM; return -ENOMEM;
rtc->rtc_dev = devm_rtc_allocate_device(dev);
if (IS_ERR(rtc->rtc_dev))
return PTR_ERR(rtc->rtc_dev);
rtc->rtc_dev->ops = &ftrtc010_rtc_ops;
ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt, ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt,
IRQF_SHARED, pdev->name, dev); IRQF_SHARED, pdev->name, dev);
if (unlikely(ret)) if (unlikely(ret))
return ret; return ret;
rtc->rtc_dev = rtc_device_register(pdev->name, dev, return rtc_register_device(rtc->rtc_dev);
&ftrtc010_rtc_ops, THIS_MODULE);
return PTR_ERR_OR_ZERO(rtc->rtc_dev);
} }
static int ftrtc010_rtc_remove(struct platform_device *pdev) static int ftrtc010_rtc_remove(struct platform_device *pdev)
...@@ -184,7 +188,6 @@ static int ftrtc010_rtc_remove(struct platform_device *pdev) ...@@ -184,7 +188,6 @@ static int ftrtc010_rtc_remove(struct platform_device *pdev)
clk_disable_unprepare(rtc->extclk); clk_disable_unprepare(rtc->extclk);
if (!IS_ERR(rtc->pclk)) if (!IS_ERR(rtc->pclk))
clk_disable_unprepare(rtc->pclk); clk_disable_unprepare(rtc->pclk);
rtc_device_unregister(rtc->rtc_dev);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment