]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blobdiff - drivers/rtc/rtc-st-lpc.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
[mirror_ubuntu-eoan-kernel.git] / drivers / rtc / rtc-st-lpc.c
index d5222667f892ba892f2dec0074fe4be96e3a518d..bee75ca7ff79b10872b690affc6a9d388aa25844 100644 (file)
@@ -212,6 +212,10 @@ static int st_rtc_probe(struct platform_device *pdev)
        if (!rtc)
                return -ENOMEM;
 
+       rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
+       if (IS_ERR(rtc->rtc_dev))
+               return PTR_ERR(rtc->rtc_dev);
+
        spin_lock_init(&rtc->lock);
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -253,26 +257,19 @@ static int st_rtc_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, rtc);
 
-       rtc->rtc_dev = rtc_device_register("st-lpc-rtc", &pdev->dev,
-                                          &st_rtc_ops, THIS_MODULE);
-       if (IS_ERR(rtc->rtc_dev)) {
+       rtc->rtc_dev->ops = &st_rtc_ops;
+       rtc->rtc_dev->range_max = U64_MAX;
+       do_div(rtc->rtc_dev->range_max, rtc->clkrate);
+
+       ret = rtc_register_device(rtc->rtc_dev);
+       if (ret) {
                clk_disable_unprepare(rtc->clk);
-               return PTR_ERR(rtc->rtc_dev);
+               return ret;
        }
 
        return 0;
 }
 
-static int st_rtc_remove(struct platform_device *pdev)
-{
-       struct st_rtc *rtc = platform_get_drvdata(pdev);
-
-       if (likely(rtc->rtc_dev))
-               rtc_device_unregister(rtc->rtc_dev);
-
-       return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int st_rtc_suspend(struct device *dev)
 {
@@ -325,7 +322,6 @@ static struct platform_driver st_rtc_platform_driver = {
                .of_match_table = st_rtc_match,
        },
        .probe = st_rtc_probe,
-       .remove = st_rtc_remove,
 };
 
 module_platform_driver(st_rtc_platform_driver);