aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ab8500.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 19:20:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 21:28:36 -0400
commitfa11f7e777077210fad0a962699f874d83fc9bfd (patch)
treee5e23e07715b7e10498be7fffae80cf3d05655f4 /drivers/rtc/rtc-ab8500.c
parente035be6a551ea4a241784a0f3c53a7f2f2425ec4 (diff)
rtc: rtc-ab8500: use devm_*() functions
Use devm_*() functions to make 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-ab8500.c')
-rw-r--r--drivers/rtc/rtc-ab8500.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index 57cde2b061e6..63cfa314a39f 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -422,20 +422,19 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
422 422
423 device_init_wakeup(&pdev->dev, true); 423 device_init_wakeup(&pdev->dev, true);
424 424
425 rtc = rtc_device_register("ab8500-rtc", &pdev->dev, &ab8500_rtc_ops, 425 rtc = devm_rtc_device_register(&pdev->dev, "ab8500-rtc",
426 THIS_MODULE); 426 &ab8500_rtc_ops, THIS_MODULE);
427 if (IS_ERR(rtc)) { 427 if (IS_ERR(rtc)) {
428 dev_err(&pdev->dev, "Registration failed\n"); 428 dev_err(&pdev->dev, "Registration failed\n");
429 err = PTR_ERR(rtc); 429 err = PTR_ERR(rtc);
430 return err; 430 return err;
431 } 431 }
432 432
433 err = request_threaded_irq(irq, NULL, rtc_alarm_handler, 433 err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
434 IRQF_NO_SUSPEND | IRQF_ONESHOT, "ab8500-rtc", rtc); 434 rtc_alarm_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
435 if (err < 0) { 435 "ab8500-rtc", rtc);
436 rtc_device_unregister(rtc); 436 if (err < 0)
437 return err; 437 return err;
438 }
439 438
440 platform_set_drvdata(pdev, rtc); 439 platform_set_drvdata(pdev, rtc);
441 440
@@ -450,13 +449,8 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
450 449
451static int ab8500_rtc_remove(struct platform_device *pdev) 450static int ab8500_rtc_remove(struct platform_device *pdev)
452{ 451{
453 struct rtc_device *rtc = platform_get_drvdata(pdev);
454 int irq = platform_get_irq_byname(pdev, "ALARM");
455
456 ab8500_sysfs_rtc_unregister(&pdev->dev); 452 ab8500_sysfs_rtc_unregister(&pdev->dev);
457 453
458 free_irq(irq, rtc);
459 rtc_device_unregister(rtc);
460 platform_set_drvdata(pdev, NULL); 454 platform_set_drvdata(pdev, NULL);
461 455
462 return 0; 456 return 0;