aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-tps6586x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-tps6586x.c')
-rw-r--r--drivers/rtc/rtc-tps6586x.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-tps6586x.c b/drivers/rtc/rtc-tps6586x.c
index aab4e8c93622..459c2ffc95a6 100644
--- a/drivers/rtc/rtc-tps6586x.c
+++ b/drivers/rtc/rtc-tps6586x.c
@@ -274,7 +274,7 @@ static int tps6586x_rtc_probe(struct platform_device *pdev)
274 } 274 }
275 275
276 platform_set_drvdata(pdev, rtc); 276 platform_set_drvdata(pdev, rtc);
277 rtc->rtc = rtc_device_register(dev_name(&pdev->dev), &pdev->dev, 277 rtc->rtc = devm_rtc_device_register(&pdev->dev, dev_name(&pdev->dev),
278 &tps6586x_rtc_ops, THIS_MODULE); 278 &tps6586x_rtc_ops, THIS_MODULE);
279 if (IS_ERR(rtc->rtc)) { 279 if (IS_ERR(rtc->rtc)) {
280 ret = PTR_ERR(rtc->rtc); 280 ret = PTR_ERR(rtc->rtc);
@@ -289,15 +289,12 @@ static int tps6586x_rtc_probe(struct platform_device *pdev)
289 if (ret < 0) { 289 if (ret < 0) {
290 dev_err(&pdev->dev, "request IRQ(%d) failed with ret %d\n", 290 dev_err(&pdev->dev, "request IRQ(%d) failed with ret %d\n",
291 rtc->irq, ret); 291 rtc->irq, ret);
292 goto fail_req_irq; 292 goto fail_rtc_register;
293 } 293 }
294 disable_irq(rtc->irq); 294 disable_irq(rtc->irq);
295 device_set_wakeup_capable(&pdev->dev, 1); 295 device_set_wakeup_capable(&pdev->dev, 1);
296 return 0; 296 return 0;
297 297
298fail_req_irq:
299 rtc_device_unregister(rtc->rtc);
300
301fail_rtc_register: 298fail_rtc_register:
302 tps6586x_update(tps_dev, RTC_CTRL, 0, 299 tps6586x_update(tps_dev, RTC_CTRL, 0,
303 RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK); 300 RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK);
@@ -306,12 +303,10 @@ fail_rtc_register:
306 303
307static int tps6586x_rtc_remove(struct platform_device *pdev) 304static int tps6586x_rtc_remove(struct platform_device *pdev)
308{ 305{
309 struct tps6586x_rtc *rtc = platform_get_drvdata(pdev);
310 struct device *tps_dev = to_tps6586x_dev(&pdev->dev); 306 struct device *tps_dev = to_tps6586x_dev(&pdev->dev);
311 307
312 tps6586x_update(tps_dev, RTC_CTRL, 0, 308 tps6586x_update(tps_dev, RTC_CTRL, 0,
313 RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK); 309 RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK);
314 rtc_device_unregister(rtc->rtc);
315 return 0; 310 return 0;
316} 311}
317 312
@@ -335,9 +330,8 @@ static int tps6586x_rtc_resume(struct device *dev)
335} 330}
336#endif 331#endif
337 332
338static const struct dev_pm_ops tps6586x_pm_ops = { 333static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_rtc_suspend,
339 SET_SYSTEM_SLEEP_PM_OPS(tps6586x_rtc_suspend, tps6586x_rtc_resume) 334 tps6586x_rtc_resume);
340};
341 335
342static struct platform_driver tps6586x_rtc_driver = { 336static struct platform_driver tps6586x_rtc_driver = {
343 .driver = { 337 .driver = {