[PATCH 10/59] rtc: pcf8583: stop using deprecated RTC API
From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:47:57 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-pcf8583.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
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[] = {
--
2.29.1