diff options
Diffstat (limited to 'drivers/rtc/rtc-brcmstb-waketimer.c')
-rw-r--r-- | drivers/rtc/rtc-brcmstb-waketimer.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c index bdd6674a1054..f4010a75f2be 100644 --- a/drivers/rtc/rtc-brcmstb-waketimer.c +++ b/drivers/rtc/rtc-brcmstb-waketimer.c @@ -145,9 +145,6 @@ static int brcmstb_waketmr_settime(struct device *dev, sec = rtc_tm_to_time64(tm); - if (sec > U32_MAX || sec < 0) - return -EINVAL; - writel_relaxed(sec, timer->base + BRCMSTB_WKTMR_COUNTER); return 0; @@ -184,9 +181,6 @@ static int brcmstb_waketmr_setalarm(struct device *dev, else sec = 0; - if (sec > U32_MAX || sec < 0) - return -EINVAL; - brcmstb_waketmr_set_alarm(timer, sec); return 0; @@ -229,6 +223,10 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev) if (IS_ERR(timer->base)) return PTR_ERR(timer->base); + timer->rtc = devm_rtc_allocate_device(dev); + if (IS_ERR(timer->rtc)) + return PTR_ERR(timer->rtc); + /* * Set wakeup capability before requesting wakeup interrupt, so we can * process boot-time "wakeups" (e.g., from S5 soft-off) @@ -261,11 +259,12 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev) timer->reboot_notifier.notifier_call = brcmstb_waketmr_reboot; register_reboot_notifier(&timer->reboot_notifier); - timer->rtc = rtc_device_register("brcmstb-waketmr", dev, - &brcmstb_waketmr_ops, THIS_MODULE); - if (IS_ERR(timer->rtc)) { + timer->rtc->ops = &brcmstb_waketmr_ops; + timer->rtc->range_max = U32_MAX; + + ret = rtc_register_device(timer->rtc); + if (ret) { dev_err(dev, "unable to register device\n"); - ret = PTR_ERR(timer->rtc); goto err_notifier; } @@ -288,7 +287,6 @@ static int brcmstb_waketmr_remove(struct platform_device *pdev) struct brcmstb_waketmr *timer = dev_get_drvdata(&pdev->dev); unregister_reboot_notifier(&timer->reboot_notifier); - rtc_device_unregister(timer->rtc); return 0; } |