aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-mc13xxx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-mc13xxx.c')
-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)
325 325
326 platform_set_drvdata(pdev, priv); 326 platform_set_drvdata(pdev, priv);
327 327
328 priv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
329 &mc13xxx_rtc_ops, THIS_MODULE);
330 if (IS_ERR(priv->rtc))
331 return PTR_ERR(priv->rtc);
332
328 mc13xxx_lock(mc13xxx); 333 mc13xxx_lock(mc13xxx);
329 334
330 ret = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_RTCRST, 335 ret = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_RTCRST,
@@ -342,35 +347,20 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev)
342 ret = mc13xxx_irq_request_nounmask(mc13xxx, MC13XXX_IRQ_1HZ, 347 ret = mc13xxx_irq_request_nounmask(mc13xxx, MC13XXX_IRQ_1HZ,
343 mc13xxx_rtc_update_handler, DRIVER_NAME, priv); 348 mc13xxx_rtc_update_handler, DRIVER_NAME, priv);
344 if (ret) 349 if (ret)
345 goto err_update_irq_request; 350 goto err_reset_irq_status;
346 351
347 ret = mc13xxx_irq_request_nounmask(mc13xxx, MC13XXX_IRQ_TODA, 352 ret = mc13xxx_irq_request_nounmask(mc13xxx, MC13XXX_IRQ_TODA,
348 mc13xxx_rtc_alarm_handler, DRIVER_NAME, priv); 353 mc13xxx_rtc_alarm_handler, DRIVER_NAME, priv);
349 if (ret) 354 if (!ret)
350 goto err_alarm_irq_request; 355 goto err_reset_irq_request;
351
352 mc13xxx_unlock(mc13xxx);
353
354 priv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
355 &mc13xxx_rtc_ops, THIS_MODULE);
356 if (IS_ERR(priv->rtc)) {
357 ret = PTR_ERR(priv->rtc);
358
359 mc13xxx_lock(mc13xxx);
360
361 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_TODA, priv);
362err_alarm_irq_request:
363 356
364 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_1HZ, priv); 357 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_1HZ, priv);
365err_update_irq_request:
366 358
367err_reset_irq_status: 359err_reset_irq_status:
360 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_RTCRST, priv);
368 361
369 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_RTCRST, priv);
370err_reset_irq_request: 362err_reset_irq_request:
371 363 mc13xxx_unlock(mc13xxx);
372 mc13xxx_unlock(mc13xxx);
373 }
374 364
375 return ret; 365 return ret;
376} 366}