diff options
Diffstat (limited to 'drivers/rtc/rtc-rk808.c')
-rw-r--r-- | drivers/rtc/rtc-rk808.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c index 35c9aada07c8..739c0d42e835 100644 --- a/drivers/rtc/rtc-rk808.c +++ b/drivers/rtc/rtc-rk808.c @@ -375,7 +375,6 @@ static int rk808_rtc_probe(struct platform_device *pdev) { struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent); struct rk808_rtc *rk808_rtc; - struct rtc_time tm; int ret; rk808_rtc = devm_kzalloc(&pdev->dev, sizeof(*rk808_rtc), GFP_KERNEL); @@ -404,24 +403,13 @@ static int rk808_rtc_probe(struct platform_device *pdev) return ret; } - /* set init time */ - ret = rk808_rtc_readtime(&pdev->dev, &tm); - if (ret) { - dev_err(&pdev->dev, "Failed to read RTC time\n"); - return ret; - } - ret = rtc_valid_tm(&tm); - if (ret) - dev_warn(&pdev->dev, "invalid date/time\n"); - device_init_wakeup(&pdev->dev, 1); - rk808_rtc->rtc = devm_rtc_device_register(&pdev->dev, "rk808-rtc", - &rk808_rtc_ops, THIS_MODULE); - if (IS_ERR(rk808_rtc->rtc)) { - ret = PTR_ERR(rk808_rtc->rtc); - return ret; - } + rk808_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(rk808_rtc->rtc)) + return PTR_ERR(rk808_rtc->rtc); + + rk808_rtc->rtc->ops = &rk808_rtc_ops; rk808_rtc->irq = platform_get_irq(pdev, 0); if (rk808_rtc->irq < 0) { @@ -438,9 +426,10 @@ static int rk808_rtc_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Failed to request alarm IRQ %d: %d\n", rk808_rtc->irq, ret); + return ret; } - return ret; + return rtc_register_device(rk808_rtc->rtc); } static struct platform_driver rk808_rtc_driver = { |