linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
To: alexandre.belloni@bootlin.com, Yiting Deng <yiting.deng@amlogic.com>
Cc: linux-amlogic@lists.infradead.org, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: amlogic-a4: simplify probe
Date: Mon, 3 Nov 2025 11:32:32 +0800	[thread overview]
Message-ID: <eef59589-5d52-41d6-a9db-abed2ddf9149@amlogic.com> (raw)
In-Reply-To: <20251031204724.756857-1-alexandre.belloni@bootlin.com>


Reviewed-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
On 2025/11/1 04:47, alexandre.belloni@bootlin.com wrote:
> [ EXTERNAL EMAIL ]
> 
> From: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> Use devm_device_init_wakeup to simplify probe and remove .remove as it is now
> empty.
> 
> Also remove the unnecessary error string as there are no error path without an
> error message in devm_rtc_register_device.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
>   drivers/rtc/rtc-amlogic-a4.c | 28 +++++-----------------------
>   1 file changed, 5 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-amlogic-a4.c b/drivers/rtc/rtc-amlogic-a4.c
> index a993d35e1d6b..123fb372fc9f 100644
> --- a/drivers/rtc/rtc-amlogic-a4.c
> +++ b/drivers/rtc/rtc-amlogic-a4.c
> @@ -361,38 +361,26 @@ static int aml_rtc_probe(struct platform_device *pdev)
>                                       "failed to get_enable rtc sys clk\n");
>          aml_rtc_init(rtc);
> 
> -       device_init_wakeup(dev, true);
> +       devm_device_init_wakeup(dev);
>          platform_set_drvdata(pdev, rtc);
> 
>          rtc->rtc_dev = devm_rtc_allocate_device(dev);
> -       if (IS_ERR(rtc->rtc_dev)) {
> -               ret = PTR_ERR(rtc->rtc_dev);
> -               goto err_clk;
> -       }
> +       if (IS_ERR(rtc->rtc_dev))
> +               return PTR_ERR(rtc->rtc_dev);
> 
>          ret = devm_request_irq(dev, rtc->irq, aml_rtc_handler,
>                                 IRQF_ONESHOT, "aml-rtc alarm", rtc);
>          if (ret) {
>                  dev_err_probe(dev, ret, "IRQ%d request failed, ret = %d\n",
>                                rtc->irq, ret);
> -               goto err_clk;
> +               return ret;
>          }
> 
>          rtc->rtc_dev->ops = &aml_rtc_ops;
>          rtc->rtc_dev->range_min = 0;
>          rtc->rtc_dev->range_max = U32_MAX;
> 
> -       ret = devm_rtc_register_device(rtc->rtc_dev);
> -       if (ret) {
> -               dev_err_probe(&pdev->dev, ret, "Failed to register RTC device: %d\n", ret);
> -               goto err_clk;
> -       }
> -
> -       return 0;
> -err_clk:
> -       device_init_wakeup(dev, false);
> -
> -       return ret;
> +       return devm_rtc_register_device(rtc->rtc_dev);
>   }
> 
>   #ifdef CONFIG_PM_SLEEP
> @@ -420,11 +408,6 @@ static int aml_rtc_resume(struct device *dev)
>   static SIMPLE_DEV_PM_OPS(aml_rtc_pm_ops,
>                           aml_rtc_suspend, aml_rtc_resume);
> 
> -static void aml_rtc_remove(struct platform_device *pdev)
> -{
> -       device_init_wakeup(&pdev->dev, false);
> -}
> -
>   static const struct aml_rtc_config a5_rtc_config = {
>   };
> 
> @@ -447,7 +430,6 @@ MODULE_DEVICE_TABLE(of, aml_rtc_device_id);
> 
>   static struct platform_driver aml_rtc_driver = {
>          .probe = aml_rtc_probe,
> -       .remove = aml_rtc_remove,
>          .driver = {
>                  .name = "aml-rtc",
>                  .pm = &aml_rtc_pm_ops,
> --
> 2.51.1
> 

      reply	other threads:[~2025-11-03  3:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 20:47 [PATCH] rtc: amlogic-a4: simplify probe alexandre.belloni
2025-11-03  3:32 ` Xianwei Zhao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eef59589-5d52-41d6-a9db-abed2ddf9149@amlogic.com \
    --to=xianwei.zhao@amlogic.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=yiting.deng@amlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).