All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: msm6242: use devm_platform_ioremap_resource()
@ 2026-07-28  0:56 Rosen Penev
  2026-07-28  1:01 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-07-28  0:56 UTC (permalink / raw)
  To: linux-rtc; +Cc: Alexandre Belloni, open list

Replace the open-coded platform_get_resource() plus devm_ioremap()
sequence with a single devm_platform_ioremap_resource() call, which folds
the resource lookup and mapping into one step and returns an ERR_PTR on
failure, checked with IS_ERR() and propagated via PTR_ERR().

The rtc-msm6242 platform device (arch/m68k/amiga/platform.c) provides a
single IORESOURCE_MEM window (0x00dc0000-0x00dcffff). It shares that
resource definition with rtc-rp5c01, but the two are registered under the
mutually exclusive A2000_CLK and A3000_CLK hardware flags, so only one
RTC device exists on a given machine. The region reservation now
performed by devm_platform_ioremap_resource() therefore introduces no
conflict.

Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/rtc/rtc-msm6242.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c
index 80e364baac53..6f28d9c2278f 100644
--- a/drivers/rtc/rtc-msm6242.c
+++ b/drivers/rtc/rtc-msm6242.c
@@ -188,21 +188,20 @@ static const struct rtc_class_ops msm6242_rtc_ops = {
 
 static int __init msm6242_rtc_probe(struct platform_device *pdev)
 {
-	struct resource *res;
 	struct msm6242_priv *priv;
 	struct rtc_device *rtc;
+	void __iomem *regs;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENODEV;
+	regs = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(regs))
+		return PTR_ERR(regs);
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
-	priv->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
-	if (!priv->regs)
-		return -ENOMEM;
+	priv->regs = regs;
+
 	platform_set_drvdata(pdev, priv);
 
 	rtc = devm_rtc_device_register(&pdev->dev, "rtc-msm6242",
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: msm6242: use devm_platform_ioremap_resource()
  2026-07-28  0:56 [PATCH] rtc: msm6242: use devm_platform_ioremap_resource() Rosen Penev
@ 2026-07-28  1:01 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-28  1:01 UTC (permalink / raw)
  To: Rosen Penev; +Cc: linux-rtc, Alexandre Belloni

> Replace the open-coded platform_get_resource() plus devm_ioremap()
> sequence with a single devm_platform_ioremap_resource() call, which folds
> the resource lookup and mapping into one step and returns an ERR_PTR on
> failure, checked with IS_ERR() and propagated via PTR_ERR().
> 
> The rtc-msm6242 platform device (arch/m68k/amiga/platform.c) provides a
> single IORESOURCE_MEM window (0x00dc0000-0x00dcffff). It shares that
> resource definition with rtc-rp5c01, but the two are registered under the
> mutually exclusive A2000_CLK and A3000_CLK hardware flags, so only one
> RTC device exists on a given machine. The region reservation now
> performed by devm_platform_ioremap_resource() therefore introduces no
> conflict.
> 
> Assisted-by: opencode:hy3-free
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

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

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260728005610.575268-1-rosenp@gmail.com?part=1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-28  1:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28  0:56 [PATCH] rtc: msm6242: use devm_platform_ioremap_resource() Rosen Penev
2026-07-28  1:01 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.