[PATCH 21/59] rtc: s5m: stop using deprecated RTC API

From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:47:09 EST


From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>

devm_rtc_device_register() is deprecated. Use devm_rtc_allocate_device()
and devm_rtc_register_device() pair instead.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
---
drivers/rtc/rtc-s5m.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 3432c6213b4c..0ddd3f445943 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -793,27 +793,27 @@ 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);

- if (!info->irq) {
- dev_info(&pdev->dev, "Alarm IRQ not available\n");
- return 0;
- }
+ info->rtc_dev->ops = &s5m_rtc_ops;

- ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
- s5m_rtc_alarm_irq, 0, "rtc-alarm0",
- info);
- if (ret < 0) {
- dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
- info->irq, ret);
- return ret;
+ if (info->irq) {
+ ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
+ s5m_rtc_alarm_irq, 0,
+ "rtc-alarm0", info);
+ if (ret < 0) {
+ dev_err(&pdev->dev,
+ "Failed to request alarm IRQ: %d: %d\n",
+ info->irq, ret);
+ return ret;
+ }
+ } else {
+ dev_info(&pdev->dev, "Alarm IRQ not available\n");
}

- return 0;
+ return devm_rtc_register_device(info->rtc_dev);
}

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