diff mbox series

[10/59] rtc: pcf8583: stop using deprecated RTC API

Message ID 20201119114149.4117-11-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: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-pcf8583.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c
index c80ca20e5d8d..93c7bb52bb78 100644
--- a/drivers/rtc/rtc-pcf8583.c
+++ b/drivers/rtc/rtc-pcf8583.c
@@ -290,11 +290,13 @@  static int pcf8583_probe(struct i2c_client *client,
 
 	i2c_set_clientdata(client, pcf8583);
 
-	pcf8583->rtc = devm_rtc_device_register(&client->dev,
-				pcf8583_driver.driver.name,
-				&pcf8583_rtc_ops, THIS_MODULE);
+	pcf8583->rtc = devm_rtc_allocate_device(&client->dev);
+	if (IS_ERR(pcf8583->rtc))
+		return PTR_ERR(pcf8583->rtc);
 
-	return PTR_ERR_OR_ZERO(pcf8583->rtc);
+	pcf8583->rtc->ops = &pcf8583_rtc_ops;
+
+	return devm_rtc_register_device(pcf8583->rtc);
 }
 
 static const struct i2c_device_id pcf8583_id[] = {