diff mbox series

[1/4] rtc: s5m: switch to devm_rtc_allocate_device

Message ID 20210804104133.5158-1-alexandre.belloni@bootlin.com
State Accepted
Headers show
Series [1/4] rtc: s5m: switch to devm_rtc_allocate_device | expand

Commit Message

Alexandre Belloni Aug. 4, 2021, 10:41 a.m. UTC
Switch to devm_rtc_allocate_device/devm_rtc_register_device, this allows
for further improvement of the driver.

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

Comments

Krzysztof Kozlowski Aug. 4, 2021, 11:43 a.m. UTC | #1
On 04/08/2021 12:41, Alexandre Belloni wrote:
> Switch to devm_rtc_allocate_device/devm_rtc_register_device, this allows
> for further improvement of the driver.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
>  drivers/rtc/rtc-s5m.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 6b56f8eacba6..4c1596c55de8 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -788,12 +788,16 @@  static int s5m_rtc_probe(struct platform_device *pdev)
 
 	device_init_wakeup(&pdev->dev, 1);
 
-	info->rtc_dev = devm_rtc_device_register(&pdev->dev, "s5m-rtc",
-						 &s5m_rtc_ops, THIS_MODULE);
-
+	info->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
 	if (IS_ERR(info->rtc_dev))
 		return PTR_ERR(info->rtc_dev);
 
+	info->rtc_dev->ops = &s5m_rtc_ops;
+
+	err = devm_rtc_register_device(info->rtc_dev);
+	if (err)
+		return err;
+
 	if (!info->irq) {
 		dev_info(&pdev->dev, "Alarm IRQ not available\n");
 		return 0;