Commit fffbe10e authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: mpc5121: convert to devm_rtc_allocate_device

This simplifies the path for the rtc_ops selection.

Link: https://lore.kernel.org/r/20200306074404.58909-2-alexandre.belloni@bootlin.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent d53d4ae9
......@@ -344,6 +344,15 @@ static int mpc5121_rtc_probe(struct platform_device *op)
goto out_dispose2;
}
rtc->rtc = devm_rtc_allocate_device(&op->dev);
if (IS_ERR(rtc->rtc)) {
err = PTR_ERR(rtc->rtc);
goto out_dispose2;
}
rtc->rtc->ops = &mpc5200_rtc_ops;
rtc->rtc->uie_unsupported = 1;
if (of_device_is_compatible(op->dev.of_node, "fsl,mpc5121-rtc")) {
u32 ka;
ka = in_be32(&rtc->regs->keep_alive);
......@@ -352,19 +361,12 @@ static int mpc5121_rtc_probe(struct platform_device *op)
"mpc5121-rtc: Battery or oscillator failure!\n");
out_be32(&rtc->regs->keep_alive, ka);
}
rtc->rtc = devm_rtc_device_register(&op->dev, "mpc5121-rtc",
&mpc5121_rtc_ops, THIS_MODULE);
} else {
rtc->rtc = devm_rtc_device_register(&op->dev, "mpc5200-rtc",
&mpc5200_rtc_ops, THIS_MODULE);
rtc->rtc->ops = &mpc5121_rtc_ops;
}
if (IS_ERR(rtc->rtc)) {
err = PTR_ERR(rtc->rtc);
err = rtc_register_device(rtc->rtc);
if (err)
goto out_dispose2;
}
rtc->rtc->uie_unsupported = 1;
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment