rtc: ftrtc010: use devm_platform_ioremap_resource()
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.
--- drivers/rtc/rtc-ftrtc010.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/rtc/rtc-ftrtc010.c +3 -9
@@ -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
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
Replace the open-coded
platform_get_resource()plusdevm_ioremap()sequence withdevm_platform_ioremap_resource(), and propagate itsERR_PTR()directly.This also reserves the MMIO region. The only user,
gemini.dtsi, describes a single0x100window at0x45000000that no other node overlaps, so this introduces no conflict.Assisted-by LLMSigned-off-by Rosen Penev <[email protected]>
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
Quoted 10 lines · Rosen Penev
Replace the open-coded
platform_get_resource()plusdevm_ioremap()sequence withdevm_platform_ioremap_resource(), and propagate itsERR_PTR()directly.This also reserves the MMIO region. The only user,
gemini.dtsi, describes a single0x100window at0x45000000that no other node overlaps, so this introduces no conflict.Assisted-by LLMSigned-off-by Rosen Penev <[email protected]>
Looks good, thanks Rosen!
Yours,
Linus Walleij