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

From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:49:09 EST


From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>

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

Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
---
drivers/rtc/rtc-ds1390.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

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[] = {
--
2.29.1