Commit 3030cf95 authored by Alexandre Belloni's avatar Alexandre Belloni Committed by Matt Turner

alpha: rtc: simplify alpha_rtc_init

Use devm_rtc_allocate_device to simplify choosing the rtc_ops in
alpha_rtc_init().
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: default avatarMatt Turner <mattst88@gmail.com>
parent a104d44b
......@@ -198,26 +198,24 @@ static const struct rtc_class_ops remote_rtc_ops = {
static int __init
alpha_rtc_init(void)
{
const struct rtc_class_ops *ops;
struct platform_device *pdev;
struct rtc_device *rtc;
const char *name;
init_rtc_epoch();
name = "rtc-alpha";
ops = &alpha_rtc_ops;
#ifdef HAVE_REMOTE_RTC
if (alpha_mv.rtc_boot_cpu_only)
ops = &remote_rtc_ops;
#endif
pdev = platform_device_register_simple(name, -1, NULL, 0);
rtc = devm_rtc_device_register(&pdev->dev, name, ops, THIS_MODULE);
pdev = platform_device_register_simple("rtc-alpha", -1, NULL, 0);
rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc))
return PTR_ERR(rtc);
platform_set_drvdata(pdev, rtc);
return 0;
rtc->ops = &alpha_rtc_ops;
#ifdef HAVE_REMOTE_RTC
if (alpha_mv.rtc_boot_cpu_only)
rtc->ops = &remote_rtc_ops;
#endif
return rtc_register_device(rtc);
}
device_initcall(alpha_rtc_init);
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