aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1511.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 19:18:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 21:28:25 -0400
commitf650e657afdefc11f735e6fd49451af5ac2253ed (patch)
tree2a512d8003aa1b061f91b50f77b5e4bc11c1e911 /drivers/rtc/rtc-ds1511.c
parent8ae236b8c97fc65fd586fa6993184d2890b7016b (diff)
rtc: rtc-ds1511: use devm_rtc_device_register()
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>
Diffstat (limited to 'drivers/rtc/rtc-ds1511.c')
-rw-r--r--drivers/rtc/rtc-ds1511.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index 6a3fcfe3b0e7..6ce8a997cf51 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -538,15 +538,14 @@ static int ds1511_rtc_probe(struct platform_device *pdev)
538 } 538 }
539 } 539 }
540 540
541 rtc = rtc_device_register(pdev->name, &pdev->dev, &ds1511_rtc_ops, 541 rtc = devm_rtc_device_register(&pdev->dev, pdev->name, &ds1511_rtc_ops,
542 THIS_MODULE); 542 THIS_MODULE);
543 if (IS_ERR(rtc)) 543 if (IS_ERR(rtc))
544 return PTR_ERR(rtc); 544 return PTR_ERR(rtc);
545 pdata->rtc = rtc; 545 pdata->rtc = rtc;
546 546
547 ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1511_nvram_attr); 547 ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1511_nvram_attr);
548 if (ret) 548
549 rtc_device_unregister(pdata->rtc);
550 return ret; 549 return ret;
551} 550}
552 551
@@ -555,7 +554,6 @@ static int ds1511_rtc_remove(struct platform_device *pdev)
555 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 554 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
556 555
557 sysfs_remove_bin_file(&pdev->dev.kobj, &ds1511_nvram_attr); 556 sysfs_remove_bin_file(&pdev->dev.kobj, &ds1511_nvram_attr);
558 rtc_device_unregister(pdata->rtc);
559 if (pdata->irq > 0) { 557 if (pdata->irq > 0) {
560 /* 558 /*
561 * disable the alarm interrupt 559 * disable the alarm interrupt