diff mbox series

[03/59] rtc: ds1390: stop using deprecated RTC API

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

Commit Message

Bartosz Golaszewski Nov. 19, 2020, 11:40 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-ds1390.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index 66fc8617d07e..9e4d09eac323 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -203,14 +203,13 @@  static int ds1390_probe(struct spi_device *spi)
 	if (spi->dev.of_node)
 		ds1390_trickle_of_init(spi);
 
-	chip->rtc = devm_rtc_device_register(&spi->dev, "ds1390",
-					&ds1390_rtc_ops, THIS_MODULE);
-	if (IS_ERR(chip->rtc)) {
-		dev_err(&spi->dev, "unable to register device\n");
-		res = PTR_ERR(chip->rtc);
-	}
+	chip->rtc = devm_rtc_allocate_device(&spi->dev);
+	if (IS_ERR(chip->rtc))
+		return PTR_ERR(chip->rtc);
+
+	chip->rtc->ops = &ds1390_rtc_ops;
 
-	return res;
+	return devm_rtc_register_device(chip->rtc);
 }
 
 static const struct of_device_id ds1390_of_match[] = {