lkml.org 
[lkml]   [2020]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 28/59] rtc: ds1286: stop using deprecated RTC API
Date
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
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
\
 
 \ /
  Last update: 2020-11-19 13:10    [W:1.019 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site