From: Bartosz Golaszewski <[email protected]>

devm_rtc_device_register() is deprecated. Use devm_rtc_allocate_device()
and devm_rtc_register_device() pair instead.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
 drivers/rtc/rtc-hid-sensor-time.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/rtc/rtc-hid-sensor-time.c 
b/drivers/rtc/rtc-hid-sensor-time.c
index 1b42ee0758d2..06cd21d6d2d1 100644
--- a/drivers/rtc/rtc-hid-sensor-time.c
+++ b/drivers/rtc/rtc-hid-sensor-time.c
@@ -267,21 +267,18 @@ static int hid_time_probe(struct platform_device *pdev)
                goto err_open;
        }
 
-       /*
-        * Enable HID input processing early in order to be able to read the
-        * clock already in devm_rtc_device_register().
-        */
-       hid_device_io_start(hsdev->hdev);
+       time_state->rtc = devm_rtc_allocate_device(&pdev->dev);
+       if (IS_ERR(time_state->rtc)) {
+               ret = PTR_ERR(time_state->rtc);
+               goto err_rtc;
+       }
 
-       time_state->rtc = devm_rtc_device_register(&pdev->dev,
-                                       "hid-sensor-time", &hid_time_rtc_ops,
-                                       THIS_MODULE);
+       time_state->rtc->ops = &hid_time_rtc_ops;
+       hid_device_io_start(hsdev->hdev);
 
-       if (IS_ERR(time_state->rtc)) {
+       ret = devm_rtc_register_device(time_state->rtc);
+       if (ret) {
                hid_device_io_stop(hsdev->hdev);
-               ret = PTR_ERR(time_state->rtc);
-               time_state->rtc = NULL;
-               dev_err(&pdev->dev, "rtc device register failed!\n");
                goto err_rtc;
        }
 
-- 
2.29.1

Reply via email to