diff mbox series

[46/59] rtc: ds1302: stop using deprecated RTC API

Message ID 20201119114149.4117-47-brgl@bgdev.pl
State Rejected
Headers show
Series rtc: remove all uses of devm_rtc_device_register() | expand

Commit Message

Bartosz Golaszewski Nov. 19, 2020, 11:41 a.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/rtc/rtc-ds1302.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
diff mbox series

Patch

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)