diff options
-rw-r--r-- | drivers/rtc/rtc-sh.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 7fffe6da9478..d9e67ca4b7b9 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -530,6 +530,10 @@ static int __init sh_rtc_probe(struct platform_device *pdev) | |||
530 | rtc->clk = NULL; | 530 | rtc->clk = NULL; |
531 | } | 531 | } |
532 | 532 | ||
533 | rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev); | ||
534 | if (IS_ERR(rtc->rtc_dev)) | ||
535 | return PTR_ERR(rtc->rtc_dev); | ||
536 | |||
533 | clk_enable(rtc->clk); | 537 | clk_enable(rtc->clk); |
534 | 538 | ||
535 | rtc->capabilities = RTC_DEF_CAPABILITIES; | 539 | rtc->capabilities = RTC_DEF_CAPABILITIES; |
@@ -593,15 +597,13 @@ static int __init sh_rtc_probe(struct platform_device *pdev) | |||
593 | sh_rtc_setaie(&pdev->dev, 0); | 597 | sh_rtc_setaie(&pdev->dev, 0); |
594 | sh_rtc_setcie(&pdev->dev, 0); | 598 | sh_rtc_setcie(&pdev->dev, 0); |
595 | 599 | ||
596 | rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, "sh", | 600 | rtc->rtc_dev->ops = &sh_rtc_ops; |
597 | &sh_rtc_ops, THIS_MODULE); | ||
598 | if (IS_ERR(rtc->rtc_dev)) { | ||
599 | ret = PTR_ERR(rtc->rtc_dev); | ||
600 | goto err_unmap; | ||
601 | } | ||
602 | |||
603 | rtc->rtc_dev->max_user_freq = 256; | 601 | rtc->rtc_dev->max_user_freq = 256; |
604 | 602 | ||
603 | ret = rtc_register_device(rtc->rtc_dev); | ||
604 | if (ret) | ||
605 | goto err_unmap; | ||
606 | |||
605 | device_init_wakeup(&pdev->dev, 1); | 607 | device_init_wakeup(&pdev->dev, 1); |
606 | return 0; | 608 | return 0; |
607 | 609 | ||