diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-03-15 09:35:09 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-04-04 04:06:41 -0400 |
commit | 5b25a71b68eb9fcdc1c99447fdc4ee3c1d23a64f (patch) | |
tree | 05ecbdb805686aec5596fe5af516660796c5d40f /drivers/rtc/rtc-mv.c | |
parent | b67436152959361bd3960b948de61c055ef5cd76 (diff) |
rtc: mv: convert to devm_rtc_allocate_device
This allows further improvement of the driver.
Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-mv.c')
-rw-r--r-- | drivers/rtc/rtc-mv.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index 1e8451763832..7c0cf532a18d 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c | |||
@@ -254,15 +254,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev) | |||
254 | 254 | ||
255 | platform_set_drvdata(pdev, pdata); | 255 | platform_set_drvdata(pdev, pdata); |
256 | 256 | ||
257 | if (pdata->irq >= 0) { | 257 | pdata->rtc = devm_rtc_allocate_device(&pdev->dev); |
258 | device_init_wakeup(&pdev->dev, 1); | ||
259 | pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, | ||
260 | &mv_rtc_alarm_ops, | ||
261 | THIS_MODULE); | ||
262 | } else { | ||
263 | pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, | ||
264 | &mv_rtc_ops, THIS_MODULE); | ||
265 | } | ||
266 | if (IS_ERR(pdata->rtc)) { | 258 | if (IS_ERR(pdata->rtc)) { |
267 | ret = PTR_ERR(pdata->rtc); | 259 | ret = PTR_ERR(pdata->rtc); |
268 | goto out; | 260 | goto out; |
@@ -278,7 +270,16 @@ static int __init mv_rtc_probe(struct platform_device *pdev) | |||
278 | } | 270 | } |
279 | } | 271 | } |
280 | 272 | ||
281 | return 0; | 273 | if (pdata->irq >= 0) { |
274 | device_init_wakeup(&pdev->dev, 1); | ||
275 | pdata->rtc->ops = &mv_rtc_alarm_ops; | ||
276 | } else { | ||
277 | pdata->rtc->ops = &mv_rtc_ops; | ||
278 | } | ||
279 | |||
280 | ret = rtc_register_device(pdata->rtc); | ||
281 | if (!ret) | ||
282 | return 0; | ||
282 | out: | 283 | out: |
283 | if (!IS_ERR(pdata->clk)) | 284 | if (!IS_ERR(pdata->clk)) |
284 | clk_disable_unprepare(pdata->clk); | 285 | clk_disable_unprepare(pdata->clk); |