From: Bartosz Golaszewski <[email protected]>

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

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
 drivers/rtc/rtc-ds1286.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
index 7acf849d4902..0886ac9890c3 100644
--- a/drivers/rtc/rtc-ds1286.c
+++ b/drivers/rtc/rtc-ds1286.c
@@ -322,7 +322,6 @@ static const struct rtc_class_ops ds1286_ops = {
 
 static int ds1286_probe(struct platform_device *pdev)
 {
-       struct rtc_device *rtc;
        struct ds1286_priv *priv;
 
        priv = devm_kzalloc(&pdev->dev, sizeof(struct ds1286_priv), GFP_KERNEL);
@@ -335,12 +334,14 @@ static int ds1286_probe(struct platform_device *pdev)
 
        spin_lock_init(&priv->lock);
        platform_set_drvdata(pdev, priv);
-       rtc = devm_rtc_device_register(&pdev->dev, "ds1286", &ds1286_ops,
-                                       THIS_MODULE);
-       if (IS_ERR(rtc))
-               return PTR_ERR(rtc);
-       priv->rtc = rtc;
-       return 0;
+
+       priv->rtc = devm_rtc_allocate_device(&pdev->dev);
+       if (IS_ERR(priv->rtc))
+               return PTR_ERR(priv->rtc);
+
+       priv->rtc->ops = &ds1286_ops;
+
+       return devm_rtc_register_device(priv->rtc);
 }
 
 static struct platform_driver ds1286_platform_driver = {
-- 
2.29.1

Reply via email to