aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2014-12-10 18:52:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 20:41:13 -0500
commit4390ce002b02f3ddea2dcd1850a45b332dfd8792 (patch)
tree3b56995ed66dd996c066ecb2b49a0f036a6e3e02 /drivers/rtc
parent437b37a66a224471b669e9d3c791e908e47e804d (diff)
rtc: omap: fix class-device registration
Make sure not to register the class device until after the device has been configured. Currently, the device is not fully configured (e.g. 24-hour mode) when the class device is registered, something which involves driver callbacks for example to read the current time. Signed-off-by: Johan Hovold <johan@kernel.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Tony Lindgren <tony@atomide.com> Cc: Benot Cousson <bcousson@baylibre.com> Cc: Lokesh Vutla <lokeshvutla@ti.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Sekhar Nori <nsekhar@ti.com> Cc: Tero Kristo <t-kristo@ti.com> Cc: Keerthy J <j-keerthy@ti.com> Tested-by: Felipe Balbi <balbi@ti.com> 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-omap.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 6b10db5a5702..813bed270867 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -413,16 +413,6 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
413 rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG); 413 rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG);
414 } 414 }
415 415
416 device_init_wakeup(&pdev->dev, true);
417
418 rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
419 &omap_rtc_ops, THIS_MODULE);
420 if (IS_ERR(rtc)) {
421 ret = PTR_ERR(rtc);
422 goto err;
423 }
424 platform_set_drvdata(pdev, rtc);
425
426 /* 416 /*
427 * disable interrupts 417 * disable interrupts
428 * 418 *
@@ -446,19 +436,6 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
446 if (reg & (u8) OMAP_RTC_STATUS_ALARM) 436 if (reg & (u8) OMAP_RTC_STATUS_ALARM)
447 rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG); 437 rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG);
448 438
449 /* handle periodic and alarm irqs */
450 ret = devm_request_irq(&pdev->dev, omap_rtc_timer, rtc_irq, 0,
451 dev_name(&rtc->dev), rtc);
452 if (ret)
453 goto err;
454
455 if (omap_rtc_timer != omap_rtc_alarm) {
456 ret = devm_request_irq(&pdev->dev, omap_rtc_alarm, rtc_irq, 0,
457 dev_name(&rtc->dev), rtc);
458 if (ret)
459 goto err;
460 }
461
462 /* On boards with split power, RTC_ON_NOFF won't reset the RTC */ 439 /* On boards with split power, RTC_ON_NOFF won't reset the RTC */
463 reg = rtc_read(OMAP_RTC_CTRL_REG); 440 reg = rtc_read(OMAP_RTC_CTRL_REG);
464 if (reg & (u8) OMAP_RTC_CTRL_STOP) 441 if (reg & (u8) OMAP_RTC_CTRL_STOP)
@@ -488,6 +465,29 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
488 if (reg != new_ctrl) 465 if (reg != new_ctrl)
489 rtc_write(new_ctrl, OMAP_RTC_CTRL_REG); 466 rtc_write(new_ctrl, OMAP_RTC_CTRL_REG);
490 467
468 device_init_wakeup(&pdev->dev, true);
469
470 rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
471 &omap_rtc_ops, THIS_MODULE);
472 if (IS_ERR(rtc)) {
473 ret = PTR_ERR(rtc);
474 goto err;
475 }
476 platform_set_drvdata(pdev, rtc);
477
478 /* handle periodic and alarm irqs */
479 ret = devm_request_irq(&pdev->dev, omap_rtc_timer, rtc_irq, 0,
480 dev_name(&rtc->dev), rtc);
481 if (ret)
482 goto err;
483
484 if (omap_rtc_timer != omap_rtc_alarm) {
485 ret = devm_request_irq(&pdev->dev, omap_rtc_alarm, rtc_irq, 0,
486 dev_name(&rtc->dev), rtc);
487 if (ret)
488 goto err;
489 }
490
491 return 0; 491 return 0;
492 492
493err: 493err: