Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [PATCH] counter: ftm-quaddec: use devm_platform_ioremap_resource
@ 2026-07-14 23:43 Rosen Penev
  2026-08-30 21:55 ` William Breathitt Gray
  0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-07-14 23:43 UTC (permalink / raw)
  To: linux-iio
  Cc: Patrick Havelange, William Breathitt Gray, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

Replace the open-coded platform_get_resource() plus devm_ioremap()
sequence with devm_platform_ioremap_resource(), which fetches the
resource, requests the region and maps it in one call. Switch the error
check to IS_ERR()/PTR_ERR() and drop the now-unused struct resource
pointer.

The DT nodes (counter@29d0000 / counter@29e0000 in ls1021a.dtsi) each
have a single 0x10000 reg region, so the region reservation added by
devm_ioremap_resource() is exclusive and does not introduce overlap
failures.

Built for ARM (drivers/counter/ftm-quaddec.o) with LLVM=1.

Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/counter/ftm-quaddec.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/counter/ftm-quaddec.c b/drivers/counter/ftm-quaddec.c
index 8455f16d62cb..ed93f3621d2a 100644
--- a/drivers/counter/ftm-quaddec.c
+++ b/drivers/counter/ftm-quaddec.c
@@ -262,28 +262,22 @@ static int ftm_quaddec_probe(struct platform_device *pdev)
 	struct ftm_quaddec *ftm;
 
 	struct device_node *node = pdev->dev.of_node;
-	struct resource *io;
+	void __iomem *ftm_base;
 	int ret;
 
+	ftm_base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(ftm_base))
+		return PTR_ERR(ftm_base);
+
 	counter = devm_counter_alloc(&pdev->dev, sizeof(*ftm));
 	if (!counter)
 		return -ENOMEM;
 	ftm = counter_priv(counter);
 
-	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!io) {
-		dev_err(&pdev->dev, "Failed to get memory region\n");
-		return -ENODEV;
-	}
-
 	ftm->pdev = pdev;
 	ftm->big_endian = of_property_read_bool(node, "big-endian");
-	ftm->ftm_base = devm_ioremap(&pdev->dev, io->start, resource_size(io));
+	ftm->ftm_base = ftm_base;
 
-	if (!ftm->ftm_base) {
-		dev_err(&pdev->dev, "Failed to map memory region\n");
-		return -EINVAL;
-	}
 	counter->name = dev_name(&pdev->dev);
 	counter->parent = &pdev->dev;
 	counter->ops = &ftm_quaddec_cnt_ops;
-- 
2.55.0


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

* Re: [PATCH] counter: ftm-quaddec: use devm_platform_ioremap_resource
  2026-07-14 23:43 [PATCH] counter: ftm-quaddec: use devm_platform_ioremap_resource Rosen Penev
@ 2026-08-30 21:55 ` William Breathitt Gray
  0 siblings, 0 replies; 2+ messages in thread
From: William Breathitt Gray @ 2026-08-30 21:55 UTC (permalink / raw)
  To: Rosen Penev
  Cc: William Breathitt Gray, linux-iio, Patrick Havelange,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-kernel, llvm

On Tue, Jul 14, 2026 at 04:43:50PM -0700, Rosen Penev wrote:
> Replace the open-coded platform_get_resource() plus devm_ioremap()
> sequence with devm_platform_ioremap_resource(), which fetches the
> resource, requests the region and maps it in one call. Switch the error
> check to IS_ERR()/PTR_ERR() and drop the now-unused struct resource
> pointer.
> 
> The DT nodes (counter@29d0000 / counter@29e0000 in ls1021a.dtsi) each
> have a single 0x10000 reg region, so the region reservation added by
> devm_ioremap_resource() is exclusive and does not introduce overlap
> failures.
> 
> Built for ARM (drivers/counter/ftm-quaddec.o) with LLVM=1.
> 
> Assisted-by: opencode:hy3-free
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

Hi Rosen,

Patrick Havelange is stepping down from maintenance of this driver, so
ftm-quaddec is currently considered to be in an Orphan status.[^1] If a
new maintainer comes along in the future to maintain this driver, they
will be able to assist the review of this patch.

Sincerely,

William Breathitt Gray

[^1]: https://lore.kernel.org/all/20260830-orphan-counter-drivers-v1-2-3b10ab8b3876@kernel.org/

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

end of thread, other threads:[~2026-08-30 21:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 23:43 [PATCH] counter: ftm-quaddec: use devm_platform_ioremap_resource Rosen Penev
2026-08-30 21:55 ` William Breathitt Gray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox