Commit fa11f7e7 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

rtc: rtc-ab8500: use devm_*() functions

Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e035be6a
...@@ -422,20 +422,19 @@ static int ab8500_rtc_probe(struct platform_device *pdev) ...@@ -422,20 +422,19 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, true); device_init_wakeup(&pdev->dev, true);
rtc = rtc_device_register("ab8500-rtc", &pdev->dev, &ab8500_rtc_ops, rtc = devm_rtc_device_register(&pdev->dev, "ab8500-rtc",
THIS_MODULE); &ab8500_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc)) { if (IS_ERR(rtc)) {
dev_err(&pdev->dev, "Registration failed\n"); dev_err(&pdev->dev, "Registration failed\n");
err = PTR_ERR(rtc); err = PTR_ERR(rtc);
return err; return err;
} }
err = request_threaded_irq(irq, NULL, rtc_alarm_handler, err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
IRQF_NO_SUSPEND | IRQF_ONESHOT, "ab8500-rtc", rtc); rtc_alarm_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
if (err < 0) { "ab8500-rtc", rtc);
rtc_device_unregister(rtc); if (err < 0)
return err; return err;
}
platform_set_drvdata(pdev, rtc); platform_set_drvdata(pdev, rtc);
...@@ -450,13 +449,8 @@ static int ab8500_rtc_probe(struct platform_device *pdev) ...@@ -450,13 +449,8 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
static int ab8500_rtc_remove(struct platform_device *pdev) static int ab8500_rtc_remove(struct platform_device *pdev)
{ {
struct rtc_device *rtc = platform_get_drvdata(pdev);
int irq = platform_get_irq_byname(pdev, "ALARM");
ab8500_sysfs_rtc_unregister(&pdev->dev); ab8500_sysfs_rtc_unregister(&pdev->dev);
free_irq(irq, rtc);
rtc_device_unregister(rtc);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment