Skip to contentSkip to conversation

rtc: da9052: convert to devm_rtc_allocate_device

PATCH New Alexandre Belloni 1 participant 1 message Mar 6, 2020

Subsystems (2)
lore
Share & tools
lore

Alexandre Belloni

author maintainer
#0 lore raw

PATCH 1/3 rtc: da9052: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

---
 drivers/rtc/rtc-da9052.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/rtc/rtc-da9052.c +4 -4
index 204eb7cf1aa4..e159c5911122 100644
@@ -298,12 +298,12 @@ static int da9052_rtc_probe(struct platform_device *pdev)
 		rtc_err(rtc, "Failed to disable TICKS: %d\n", ret);
 
 	device_init_wakeup(&pdev->dev, true);
-	rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-				       &da9052_rtc_ops, THIS_MODULE);
-
+	rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
 	if (IS_ERR(rtc->rtc))
 		return PTR_ERR(rtc->rtc);
 
+	rtc->rtc->ops = &da9052_rtc_ops;
+
 	ret = da9052_request_irq(rtc->da9052, DA9052_IRQ_ALARM, "ALM",
 				da9052_rtc_irq, rtc);
 	if (ret != 0) {
@@ -311,7 +311,7 @@ static int da9052_rtc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	return 0;
+	return rtc_register_device(rtc->rtc);
 }
 
 static struct platform_driver da9052_rtc_driver = {
Signature · 1 line
2.24.1