[PATCH 32/59] rtc: x1205: stop using deprecated RTC API

From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:45:59 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-x1205.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index d1d5a44d9122..b1232ebf3ee9 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -629,12 +629,11 @@ static int x1205_probe(struct i2c_client *client,
if (x1205_validate_client(client) < 0)
return -ENODEV;

- rtc = devm_rtc_device_register(&client->dev, x1205_driver.driver.name,
- &x1205_rtc_ops, THIS_MODULE);
-
+ rtc = devm_rtc_allocate_device(&client->dev);
if (IS_ERR(rtc))
return PTR_ERR(rtc);

+ rtc->ops = &x1205_rtc_ops;
i2c_set_clientdata(client, rtc);

/* Check for power failures and eventually enable the osc */
@@ -655,7 +654,7 @@ static int x1205_probe(struct i2c_client *client,
if (err)
dev_err(&client->dev, "Unable to create sysfs entries\n");

- return 0;
+ return devm_rtc_register_device(rtc);
}

static int x1205_remove(struct i2c_client *client)
--
2.29.1