diff mbox series

[04/59] rtc: ds3232: stop using deprecated RTC API

Message ID 20201119114149.4117-5-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: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-ds3232.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index 16b89035d135..962f84b1ba66 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -513,11 +513,12 @@  static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
 
 	ds3232_hwmon_register(dev, name);
 
-	ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
-						THIS_MODULE);
+	ds3232->rtc = devm_rtc_allocate_device(dev);
 	if (IS_ERR(ds3232->rtc))
 		return PTR_ERR(ds3232->rtc);
 
+	ds3232->rtc->ops = &ds3232_rtc_ops;
+
 	ret = devm_rtc_nvmem_register(ds3232->rtc, &nvmem_cfg);
 	if(ret)
 		return ret;
@@ -534,7 +535,7 @@  static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
 		}
 	}
 
-	return 0;
+	return devm_rtc_register_device(ds3232->rtc);
 }
 
 #ifdef CONFIG_PM_SLEEP