[PATCH 06/59] rtc: palmas: stop using deprecated RTC API

Bartosz Golaszewski
2020-11-19T11:42:42Z

drivers/rtc/rtc-palmas.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/rtc/rtc-palmas.c b/drivers/rtc/rtc-palmas.c
index 4bcfb88674d3..d97a751b4a9a 100644
--- a/drivers/rtc/rtc-palmas.c
+++ b/drivers/rtc/rtc-palmas.c
@@ -301,13 +301,12 @@ static int palmas_rtc_probe(struct platform_device *pdev)
palmas_rtc->irq = platform_get_irq(pdev, 0);

device_init_wakeup(&pdev->dev, 1);
- palmas_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
- &palmas_rtc_ops, THIS_MODULE);
- if (IS_ERR(palmas_rtc->rtc)) {
- ret = PTR_ERR(palmas_rtc->rtc);
- dev_err(&pdev->dev, "RTC register failed, err = %d\n", ret);
- return ret;
- }
+
+ palmas_rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(palmas_rtc->rtc))
+ return PTR_ERR(palmas_rtc->rtc);
+
+ palmas_rtc->rtc->ops = &palmas_rtc_ops;

ret = devm_request_threaded_irq(&pdev->dev, palmas_rtc->irq, NULL,
palmas_rtc_interrupt,
@@ -318,7 +317,7 @@ static int palmas_rtc_probe(struct platform_device *pdev)
return ret;
}

- return 0;
+ return devm_rtc_register_device(palmas_rtc->rtc);
}

static int palmas_rtc_remove(struct platform_device *pdev)
--
2.29.1