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 41/59] rtc: max8997: 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-max8997.c | 21 +++++++++------------
    1 file changed, 9 insertions(+), 12 deletions(-)

    diff --git a/drivers/rtc/rtc-max8997.c b/drivers/rtc/rtc-max8997.c
    index 20e50d9fdf88..d4d40851aecd 100644
    --- a/drivers/rtc/rtc-max8997.c
    +++ b/drivers/rtc/rtc-max8997.c
    @@ -475,32 +475,29 @@ static int max8997_rtc_probe(struct platform_device *pdev)

    device_init_wakeup(&pdev->dev, 1);

    - info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8997-rtc",
    - &max8997_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 (IS_ERR(info->rtc_dev)) {
    - ret = PTR_ERR(info->rtc_dev);
    - dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
    - return ret;
    - }
    + info->rtc_dev->ops = &max8997_rtc_ops;

    virq = irq_create_mapping(max8997->irq_domain, MAX8997_PMICIRQ_RTCA1);
    if (!virq) {
    dev_err(&pdev->dev, "Failed to create mapping alarm IRQ\n");
    - ret = -ENXIO;
    - goto err_out;
    + return -ENXIO;
    }
    info->virq = virq;

    ret = devm_request_threaded_irq(&pdev->dev, virq, NULL,
    max8997_rtc_alarm_irq, 0,
    "rtc-alarm0", info);
    - if (ret < 0)
    + if (ret < 0) {
    dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
    info->virq, ret);
    + return ret;
    + }

    -err_out:
    - return ret;
    + return devm_rtc_register_device(info->rtc_dev);
    }

    static void max8997_rtc_shutdown(struct platform_device *pdev)
    --
    2.29.1
    \
     
     \ /
      Last update: 2020-11-19 12:46    [W:4.013 / U:0.456 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site