Skip to contentSkip to conversation

rtc: ftrtc010: use devm_platform_ioremap_resource()

PATCH In review Rosen Penev 3 participants 3 messages Oct 4 – Oct 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: ftrtc010: use devm_platform_ioremap_resource()

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
---
 drivers/rtc/rtc-ftrtc010.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/rtc/rtc-ftrtc010.c +3 -9
index b29c96be40f4..3e88cb224f67 100644
@@ -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))
Signature · 1 line
2.56.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines

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

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Rosen Penev
Quoted 10 lines · Rosen Penev

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

Looks good, thanks Rosen!

Yours,
Linus Walleij