summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-04-04 01:49:57 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-04 03:21:20 +0400
commit589e501439f9866b4bc415743b0ae0bb9a461c69 (patch)
treeaa56c1a2b0fbc1528497d4d08e1aedd52667a92a /drivers/rtc
parent77bf2ea8de78ce7dd842409a847b888e720f62d8 (diff)
downloadlinux-589e501439f9866b4bc415743b0ae0bb9a461c69.tar.xz
rtc: mc13xxx: request IRQs after RTC registration
Interrupts can appear after request_irq and interrupt handlers can use the RTC device, but currently we register RTC after IRQs. This patch changes this order and simplify error path a bit. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: Sascha Hauer <kernel@pengutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-mc13xxx.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index 480d51f71064..6b5d7d43af89 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -325,6 +325,11 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
+ priv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
+ &mc13xxx_rtc_ops, THIS_MODULE);
+ if (IS_ERR(priv->rtc))
+ return PTR_ERR(priv->rtc);
+
mc13xxx_lock(mc13xxx);
ret = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_RTCRST,
@@ -342,35 +347,20 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev)
ret = mc13xxx_irq_request_nounmask(mc13xxx, MC13XXX_IRQ_1HZ,
mc13xxx_rtc_update_handler, DRIVER_NAME, priv);
if (ret)
- goto err_update_irq_request;
+ goto err_reset_irq_status;
ret = mc13xxx_irq_request_nounmask(mc13xxx, MC13XXX_IRQ_TODA,
mc13xxx_rtc_alarm_handler, DRIVER_NAME, priv);
- if (ret)
- goto err_alarm_irq_request;
-
- mc13xxx_unlock(mc13xxx);
-
- priv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
- &mc13xxx_rtc_ops, THIS_MODULE);
- if (IS_ERR(priv->rtc)) {
- ret = PTR_ERR(priv->rtc);
-
- mc13xxx_lock(mc13xxx);
-
- mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_TODA, priv);
-err_alarm_irq_request:
+ if (!ret)
+ goto err_reset_irq_request;
- mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_1HZ, priv);
-err_update_irq_request:
+ mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_1HZ, priv);
err_reset_irq_status:
+ mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_RTCRST, priv);
- mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_RTCRST, priv);
err_reset_irq_request:
-
- mc13xxx_unlock(mc13xxx);
- }
+ mc13xxx_unlock(mc13xxx);
return ret;
}