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-ds1302.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/rtc/rtc-ds1302.c b/drivers/rtc/rtc-ds1302.c
index b3de6d2e680a..2ab0d6ea3a1c 100644
--- a/drivers/rtc/rtc-ds1302.c
+++ b/drivers/rtc/rtc-ds1302.c
@@ -174,15 +174,13 @@ static int ds1302_probe(struct spi_device *spi)
 
        spi_set_drvdata(spi, spi);
 
-       rtc = devm_rtc_device_register(&spi->dev, "ds1302",
-                       &ds1302_rtc_ops, THIS_MODULE);
-       if (IS_ERR(rtc)) {
-               status = PTR_ERR(rtc);
-               dev_err(&spi->dev, "error %d registering rtc\n", status);
-               return status;
-       }
+       rtc = devm_rtc_allocate_device(&spi->dev);
+       if (IS_ERR(rtc))
+               return PTR_ERR(rtc);
 
-       return 0;
+       rtc->ops = &ds1302_rtc_ops;
+
+       return devm_rtc_register_device(rtc);
 }
 
 static int ds1302_remove(struct spi_device *spi)
-- 
2.29.1

Reply via email to