Skip to content

Commit 0739860

Browse files
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
1 parent 1350b94 commit 0739860

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/rtc/rtc-hym8563.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ static int hym8563_probe(struct i2c_client *client,
523523
if (!hym8563)
524524
return -ENOMEM;
525525

526+
hym8563->rtc = devm_rtc_allocate_device(&client->dev);
527+
if (IS_ERR(hym8563->rtc))
528+
return PTR_ERR(hym8563->rtc);
529+
526530
hym8563->client = client;
527531
i2c_set_clientdata(client, hym8563);
528532

@@ -557,19 +561,15 @@ static int hym8563_probe(struct i2c_client *client,
557561
dev_dbg(&client->dev, "rtc information is %s\n",
558562
(ret & HYM8563_SEC_VL) ? "invalid" : "valid");
559563

560-
hym8563->rtc = devm_rtc_device_register(&client->dev, client->name,
561-
&hym8563_rtc_ops, THIS_MODULE);
562-
if (IS_ERR(hym8563->rtc))
563-
return PTR_ERR(hym8563->rtc);
564-
564+
hym8563->rtc->ops = &hym8563_rtc_ops;
565565
/* the hym8563 alarm only supports a minute accuracy */
566566
hym8563->rtc->uie_unsupported = 1;
567567

568568
#ifdef CONFIG_COMMON_CLK
569569
hym8563_clkout_register_clk(hym8563);
570570
#endif
571571

572-
return 0;
572+
return devm_rtc_register_device(hym8563->rtc);
573573
}
574574

575575
static const struct i2c_device_id hym8563_id[] = {

0 commit comments

Comments
 (0)