summaryrefslogtreecommitdiffstats
path: root/arch/alpha
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2018-09-09 23:15:04 +0200
committerMatt Turner <mattst88@gmail.com>2018-12-21 11:57:57 -0500
commit3030cf95ab2084678e9d2e0315d29cec80479eb0 (patch)
tree67e14ee63195e693a08cb8d773a4fee7fbd6b1f0 /arch/alpha
parenta104d44b183ce34b645bbcc8483d9d39fd488c55 (diff)
downloadlinux-0-day-3030cf95ab2084678e9d2e0315d29cec80479eb0.tar.gz
linux-0-day-3030cf95ab2084678e9d2e0315d29cec80479eb0.tar.xz
alpha: rtc: simplify alpha_rtc_init
Use devm_rtc_allocate_device to simplify choosing the rtc_ops in alpha_rtc_init(). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/kernel/rtc.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/arch/alpha/kernel/rtc.c b/arch/alpha/kernel/rtc.c
index 1376a28670482..1b1d5963ac550 100644
--- a/arch/alpha/kernel/rtc.c
+++ b/arch/alpha/kernel/rtc.c
@@ -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);