From: Rosen Penev <rosenp@gmail.com>
To: linux-iio@vger.kernel.org
Cc: Patrick Havelange <patrick.havelange@essensium.com>,
William Breathitt Gray <wbg@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-kernel@vger.kernel.org (open list),
llvm@lists.linux.dev (open list:CLANG/LLVM BUILD
SUPPORT:Keyword:\b(?i:clang|llvm)\b)
Subject: [PATCH] counter: ftm-quaddec: use devm_platform_ioremap_resource
Date: Tue, 14 Jul 2026 16:43:50 -0700 [thread overview]
Message-ID: <20260714234350.892367-1-rosenp@gmail.com> (raw)
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
reply other threads:[~2026-07-14 23:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260714234350.892367-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=justinstitt@google.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=patrick.havelange@essensium.com \
--cc=wbg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox