* [PATCH] rtc: ftrtc010: use devm_platform_ioremap_resource()
@ 2026-10-04 22:02 Rosen Penev
2026-10-05 8:57 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-10-04 22:02 UTC (permalink / raw)
To: linux-rtc
Cc: Hans Ulli Kroll, Linus Walleij, Alexandre Belloni,
moderated list:ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE,
open list
Replace the open-coded platform_get_resource() plus devm_ioremap()
sequence with devm_platform_ioremap_resource(), and propagate its
ERR_PTR() directly.
This also reserves the MMIO region. The only user, gemini.dtsi,
describes a single 0x100 window at 0x45000000 that no other node
overlaps, so this introduces no conflict.
Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/rtc/rtc-ftrtc010.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/rtc/rtc-ftrtc010.c b/drivers/rtc/rtc-ftrtc010.c
index b29c96be40f4..3e88cb224f67 100644
--- a/drivers/rtc/rtc-ftrtc010.c
+++ b/drivers/rtc/rtc-ftrtc010.c
@@ -111,7 +111,6 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
u32 days, hour, min, sec;
struct ftrtc010_rtc *rtc;
struct device *dev = &pdev->dev;
- struct resource *res;
struct rtc_device *rtc_dev;
int ret;
@@ -135,14 +134,9 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
if (rtc->rtc_irq < 0)
return rtc->rtc_irq;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
-
- rtc->rtc_base = devm_ioremap(dev, res->start,
- resource_size(res));
- if (!rtc->rtc_base)
- return -ENOMEM;
+ rtc->rtc_base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(rtc->rtc_base))
+ return PTR_ERR(rtc->rtc_base);
rtc_dev = devm_rtc_allocate_device(dev);
if (IS_ERR(rtc_dev))
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: ftrtc010: use devm_platform_ioremap_resource()
2026-10-04 22:02 [PATCH] rtc: ftrtc010: use devm_platform_ioremap_resource() Rosen Penev
@ 2026-10-05 8:57 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2026-10-05 8:57 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-rtc, Hans Ulli Kroll, Alexandre Belloni,
moderated list:ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE,
open list
On Mon, Oct 5, 2026 at 12:03 AM Rosen Penev <rosenp@gmail.com> wrote:
> Replace the open-coded platform_get_resource() plus devm_ioremap()
> sequence with devm_platform_ioremap_resource(), and propagate its
> ERR_PTR() directly.
>
> This also reserves the MMIO region. The only user, gemini.dtsi,
> describes a single 0x100 window at 0x45000000 that no other node
> overlaps, so this introduces no conflict.
>
> Assisted-by: LLM
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
Looks good, thanks Rosen!
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-05 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-04 22:02 [PATCH] rtc: ftrtc010: use devm_platform_ioremap_resource() Rosen Penev
2026-10-05 8:57 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®