* [PATCH] rtc: amlogic-a4: simplify probe
@ 2025-10-31 20:47 alexandre.belloni
2025-11-03 3:32 ` Xianwei Zhao
0 siblings, 1 reply; 2+ messages in thread
From: alexandre.belloni @ 2025-10-31 20:47 UTC (permalink / raw)
To: Yiting Deng, Xianwei Zhao, Alexandre Belloni
Cc: linux-amlogic, linux-rtc, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: amlogic-a4: simplify probe
2025-10-31 20:47 [PATCH] rtc: amlogic-a4: simplify probe alexandre.belloni
@ 2025-11-03 3:32 ` Xianwei Zhao
0 siblings, 0 replies; 2+ messages in thread
From: Xianwei Zhao @ 2025-11-03 3:32 UTC (permalink / raw)
To: alexandre.belloni, Yiting Deng; +Cc: linux-amlogic, linux-rtc, linux-kernel
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-03 3:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 20:47 [PATCH] rtc: amlogic-a4: simplify probe alexandre.belloni
2025-11-03 3:32 ` Xianwei Zhao
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).