aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-palmas.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 19:19:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 21:28:26 -0400
commit27971335ce666feb08344ca7c5fdd25f13985f62 (patch)
treee789a53ed590b941b44dfe61700cf43d352cb2cc /drivers/rtc/rtc-palmas.c
parent033ca3ad243611c85f83f150d27d8bdf322218f4 (diff)
rtc: rtc-palmas: use devm_rtc_device_register() and devm_request_threaded_irq()
devm_rtc_device_register() is device managed and makes cleanup paths simpler. Also, use devm_request_threaded_irq() to make cleanup paths more simple. 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-palmas.c')
-rw-r--r--drivers/rtc/rtc-palmas.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-palmas.c b/drivers/rtc/rtc-palmas.c
index 59c42986254e..bbc3b9efdeb2 100644
--- a/drivers/rtc/rtc-palmas.c
+++ b/drivers/rtc/rtc-palmas.c
@@ -264,7 +264,7 @@ static int palmas_rtc_probe(struct platform_device *pdev)
264 264
265 palmas_rtc->irq = platform_get_irq(pdev, 0); 265 palmas_rtc->irq = platform_get_irq(pdev, 0);
266 266
267 palmas_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, 267 palmas_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
268 &palmas_rtc_ops, THIS_MODULE); 268 &palmas_rtc_ops, THIS_MODULE);
269 if (IS_ERR(palmas_rtc->rtc)) { 269 if (IS_ERR(palmas_rtc->rtc)) {
270 ret = PTR_ERR(palmas_rtc->rtc); 270 ret = PTR_ERR(palmas_rtc->rtc);
@@ -272,14 +272,13 @@ static int palmas_rtc_probe(struct platform_device *pdev)
272 return ret; 272 return ret;
273 } 273 }
274 274
275 ret = request_threaded_irq(palmas_rtc->irq, NULL, 275 ret = devm_request_threaded_irq(&pdev->dev, palmas_rtc->irq, NULL,
276 palmas_rtc_interrupt, 276 palmas_rtc_interrupt,
277 IRQF_TRIGGER_LOW | IRQF_ONESHOT | 277 IRQF_TRIGGER_LOW | IRQF_ONESHOT |
278 IRQF_EARLY_RESUME, 278 IRQF_EARLY_RESUME,
279 dev_name(&pdev->dev), palmas_rtc); 279 dev_name(&pdev->dev), palmas_rtc);
280 if (ret < 0) { 280 if (ret < 0) {
281 dev_err(&pdev->dev, "IRQ request failed, err = %d\n", ret); 281 dev_err(&pdev->dev, "IRQ request failed, err = %d\n", ret);
282 rtc_device_unregister(palmas_rtc->rtc);
283 return ret; 282 return ret;
284 } 283 }
285 284
@@ -289,11 +288,7 @@ static int palmas_rtc_probe(struct platform_device *pdev)
289 288
290static int palmas_rtc_remove(struct platform_device *pdev) 289static int palmas_rtc_remove(struct platform_device *pdev)
291{ 290{
292 struct palmas_rtc *palmas_rtc = platform_get_drvdata(pdev);
293
294 palmas_rtc_alarm_irq_enable(&pdev->dev, 0); 291 palmas_rtc_alarm_irq_enable(&pdev->dev, 0);
295 free_irq(palmas_rtc->irq, palmas_rtc);
296 rtc_device_unregister(palmas_rtc->rtc);
297 return 0; 292 return 0;
298} 293}
299 294