summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-rx8025.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2021-11-07 23:54:52 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2021-11-10 00:45:57 +0100
commit5e7f635aa64764f34266d22ee0fa27c8f4834309 (patch)
tree448394087d28b3ee4d2855c54c8d6918b9e0ee55 /drivers/rtc/rtc-rx8025.c
parenta5f828036c2e9f46d84c7c9b27bf248c7f4bb0fe (diff)
rtc: rx8025: 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/20211107225458.111068-7-alexandre.belloni@bootlin.com
Diffstat (limited to 'drivers/rtc/rtc-rx8025.c')
-rw-r--r--drivers/rtc/rtc-rx8025.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index d38aaf08108c..617b044c66f0 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -559,12 +559,11 @@ static int rx8025_probe(struct i2c_client *client,
if (err)
return err;
- rx8025->rtc = devm_rtc_device_register(&client->dev, client->name,
- &rx8025_rtc_ops, THIS_MODULE);
- if (IS_ERR(rx8025->rtc)) {
- dev_err(&client->dev, "unable to register the class device\n");
+ rx8025->rtc = devm_rtc_allocate_device(&client->dev);
+ if (IS_ERR(rx8025->rtc))
return PTR_ERR(rx8025->rtc);
- }
+
+ rx8025->rtc->ops = &rx8025_rtc_ops;
if (client->irq > 0) {
dev_info(&client->dev, "IRQ %d supplied\n", client->irq);
@@ -583,6 +582,10 @@ static int rx8025_probe(struct i2c_client *client,
/* the rx8025 alarm only supports a minute accuracy */
rx8025->rtc->uie_unsupported = 1;
+ err = devm_rtc_register_device(rx8025->rtc);
+ if (err)
+ return err;
+
err = rx8025_sysfs_register(&client->dev);
return err;
}