rtc: rx8581: switch to rtc_register_device

This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
Alexandre Belloni 2018-05-17 22:33:25 +02:00
parent 57ad9e6925
commit b815716820
1 changed files with 5 additions and 8 deletions

View File

@ -286,16 +286,13 @@ static int rx8581_probe(struct i2c_client *client,
rx8581->write_block_data = rx8581_write_block_data;
}
rx8581->rtc = devm_rtc_device_register(&client->dev,
rx8581_driver.driver.name, &rx8581_rtc_ops, THIS_MODULE);
if (IS_ERR(rx8581->rtc)) {
dev_err(&client->dev,
"unable to register the class device\n");
rx8581->rtc = devm_rtc_allocate_device(&client->dev);
if (IS_ERR(rx8581->rtc))
return PTR_ERR(rx8581->rtc);
}
return 0;
rx8581->rtc->ops = &rx8581_rtc_ops;
return rtc_register_device(rx8581->rtc);
}
static const struct i2c_device_id rx8581_id[] = {