summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-hym8563.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2022-03-09 17:22:56 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2022-03-23 19:58:40 +0100
commit07398602c84adf49a0b908313f85370792e8cc68 (patch)
tree6ed601309a222ef004342d58b0fdee750567e97a /drivers/rtc/rtc-hym8563.c
parent1350b94c94ccd8cc585709e21bad6380d50112e1 (diff)
downloadlinux-07398602c84adf49a0b908313f85370792e8cc68.tar.gz
rtc: hym8563: switch to devm_rtc_allocate_device
Switch to devm_rtc_allocate_device/devm_rtc_register_device, this allows for further improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220309162301.61679-25-alexandre.belloni@bootlin.com
Diffstat (limited to 'drivers/rtc/rtc-hym8563.c')
-rw-r--r--drivers/rtc/rtc-hym8563.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c
index 0751cae27285..ce4cbf0f48e7 100644
--- a/drivers/rtc/rtc-hym8563.c
+++ b/drivers/rtc/rtc-hym8563.c
@@ -523,6 +523,10 @@ static int hym8563_probe(struct i2c_client *client,
if (!hym8563)
return -ENOMEM;
+ hym8563->rtc = devm_rtc_allocate_device(&client->dev);
+ if (IS_ERR(hym8563->rtc))
+ return PTR_ERR(hym8563->rtc);
+
hym8563->client = client;
i2c_set_clientdata(client, hym8563);
@@ -557,11 +561,7 @@ static int hym8563_probe(struct i2c_client *client,
dev_dbg(&client->dev, "rtc information is %s\n",
(ret & HYM8563_SEC_VL) ? "invalid" : "valid");
- hym8563->rtc = devm_rtc_device_register(&client->dev, client->name,
- &hym8563_rtc_ops, THIS_MODULE);
- if (IS_ERR(hym8563->rtc))
- return PTR_ERR(hym8563->rtc);
-
+ hym8563->rtc->ops = &hym8563_rtc_ops;
/* the hym8563 alarm only supports a minute accuracy */
hym8563->rtc->uie_unsupported = 1;
@@ -569,7 +569,7 @@ static int hym8563_probe(struct i2c_client *client,
hym8563_clkout_register_clk(hym8563);
#endif
- return 0;
+ return devm_rtc_register_device(hym8563->rtc);
}
static const struct i2c_device_id hym8563_id[] = {