From: Rosen Penev <rosenp@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@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] ata: pata_pxa: use devm_platform_ioremap_resource
Date: Tue, 14 Jul 2026 18:13:43 -0700 [thread overview]
Message-ID: <20260715011343.1270261-1-rosenp@gmail.com> (raw)
Replace the open-coded platform_get_resource() plus devm_ioremap()
sequences for the CMD and CTL ports with devm_platform_ioremap_resource(),
which fetches the resource, requests the region and maps it in one call.
Switch the error checks to IS_ERR()/PTR_ERR() accordingly and drop the
now-unused cmd_res and ctl_res variables.
The DMA port keeps using devm_ioremap() as its resource is
IORESOURCE_DMA. The CMD (res 0) and CTL (res 1) MEM resources are
disjoint in the ATA task-file layout, so the added region reservation
in devm_ioremap_resource() does not introduce overlap failures.
Built for ARM (drivers/ata/pata_pxa.o) with LLVM=1.
Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/ata/pata_pxa.c | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
index 9f63bdfb8576..c816997dc0a9 100644
--- a/drivers/ata/pata_pxa.c
+++ b/drivers/ata/pata_pxa.c
@@ -161,8 +161,6 @@ static int pxa_ata_probe(struct platform_device *pdev)
struct ata_host *host;
struct ata_port *ap;
struct pata_pxa_data *data;
- struct resource *cmd_res;
- struct resource *ctl_res;
struct resource *dma_res;
struct pata_pxa_pdata *pdata = dev_get_platdata(&pdev->dev);
struct dma_slave_config config;
@@ -181,20 +179,6 @@ static int pxa_ata_probe(struct platform_device *pdev)
return -EINVAL;
}
- /*
- * CMD port base address
- */
- cmd_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (unlikely(cmd_res == NULL))
- return -EINVAL;
-
- /*
- * CTL port base address
- */
- ctl_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (unlikely(ctl_res == NULL))
- return -EINVAL;
-
/*
* DMA port base address
*/
@@ -221,14 +205,12 @@ static int pxa_ata_probe(struct platform_device *pdev)
ap->pio_mask = ATA_PIO4;
ap->mwdma_mask = ATA_MWDMA2;
- ap->ioaddr.cmd_addr = devm_ioremap(&pdev->dev, cmd_res->start,
- resource_size(cmd_res));
- if (!ap->ioaddr.cmd_addr)
- return -ENOMEM;
- ap->ioaddr.ctl_addr = devm_ioremap(&pdev->dev, ctl_res->start,
- resource_size(ctl_res));
- if (!ap->ioaddr.ctl_addr)
- return -ENOMEM;
+ ap->ioaddr.cmd_addr = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(ap->ioaddr.cmd_addr))
+ return PTR_ERR(ap->ioaddr.cmd_addr);
+ ap->ioaddr.ctl_addr = devm_platform_ioremap_resource(pdev, 1);
+ if (IS_ERR(ap->ioaddr.ctl_addr))
+ return PTR_ERR(ap->ioaddr.ctl_addr);
ap->ioaddr.bmdma_addr = devm_ioremap(&pdev->dev, dma_res->start,
resource_size(dma_res));
if (!ap->ioaddr.bmdma_addr)
--
2.55.0
next reply other threads:[~2026-07-15 1:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 1:13 Rosen Penev [this message]
2026-07-15 1:25 ` [PATCH] ata: pata_pxa: use devm_platform_ioremap_resource sashiko-bot
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=20260715011343.1270261-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-ide@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 \
/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