diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-04-29 19:19:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:25 -0400 |
commit | f7cfdea08a148f89b4139f3e74be0b7fbc271c13 (patch) | |
tree | c8a689dd9349bf461bd151c7c4f929789b5cd56c /drivers/rtc/rtc-ds1742.c | |
parent | c1be915ee03ac9b4c02a6b75f31283a69d55cf03 (diff) |
rtc: rtc-ds1742: 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-ds1742.c')
-rw-r--r-- | drivers/rtc/rtc-ds1742.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 609c870e2cc5..eccdc62ae1c0 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c | |||
@@ -208,17 +208,14 @@ static int ds1742_rtc_probe(struct platform_device *pdev) | |||
208 | 208 | ||
209 | pdata->last_jiffies = jiffies; | 209 | pdata->last_jiffies = jiffies; |
210 | platform_set_drvdata(pdev, pdata); | 210 | platform_set_drvdata(pdev, pdata); |
211 | rtc = rtc_device_register(pdev->name, &pdev->dev, | 211 | rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
212 | &ds1742_rtc_ops, THIS_MODULE); | 212 | &ds1742_rtc_ops, THIS_MODULE); |
213 | if (IS_ERR(rtc)) | 213 | if (IS_ERR(rtc)) |
214 | return PTR_ERR(rtc); | 214 | return PTR_ERR(rtc); |
215 | pdata->rtc = rtc; | 215 | pdata->rtc = rtc; |
216 | 216 | ||
217 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &pdata->nvram_attr); | 217 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &pdata->nvram_attr); |
218 | if (ret) { | 218 | |
219 | dev_err(&pdev->dev, "creating nvram file in sysfs failed\n"); | ||
220 | rtc_device_unregister(rtc); | ||
221 | } | ||
222 | return ret; | 219 | return ret; |
223 | } | 220 | } |
224 | 221 | ||
@@ -227,7 +224,6 @@ static int ds1742_rtc_remove(struct platform_device *pdev) | |||
227 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 224 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
228 | 225 | ||
229 | sysfs_remove_bin_file(&pdev->dev.kobj, &pdata->nvram_attr); | 226 | sysfs_remove_bin_file(&pdev->dev.kobj, &pdata->nvram_attr); |
230 | rtc_device_unregister(pdata->rtc); | ||
231 | return 0; | 227 | return 0; |
232 | } | 228 | } |
233 | 229 | ||