diff mbox series

[1/3] rtc: test: convert to devm_rtc_allocate_device

Message ID 20180605210914.8054-1-alexandre.belloni@bootlin.com
State Accepted
Headers show
Series [1/3] rtc: test: convert to devm_rtc_allocate_device | expand

Commit Message

Alexandre Belloni June 5, 2018, 9:09 p.m. UTC
This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-test.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c
index 70d4ab1d2769..6a6bc1f2a14d 100644
--- a/drivers/rtc/rtc-test.c
+++ b/drivers/rtc/rtc-test.c
@@ -120,15 +120,16 @@  static int test_probe(struct platform_device *plat_dev)
 
 	platform_set_drvdata(plat_dev, rtd);
 
-	rtd->rtc = devm_rtc_device_register(&plat_dev->dev, "test",
-					    &test_rtc_ops, THIS_MODULE);
+	rtd->rtc = devm_rtc_allocate_device(&plat_dev->dev);
 	if (IS_ERR(rtd->rtc))
 		return PTR_ERR(rtd->rtc);
 
+	rtd->rtc->ops = &test_rtc_ops;
+
 	timer_setup(&rtd->alarm, test_rtc_alarm_handler, 0);
 	rtd->alarm.expires = 0;
 
-	return 0;
+	return rtc_register_device(rtd->rtc);
 }
 
 static struct platform_driver test_driver = {