* [PATCH] ASoC: amd: acp: Use pcim_iomap_region() in acp-pci
@ 2026-07-20 0:10 Rosen Penev
2026-08-01 1:02 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-07-20 0:10 UTC (permalink / raw)
To: linux-sound
Cc: Vijendar Mukunda, Venkata Prasad Potturu, Liam Girdwood,
Mark Brown, Jaroslav Kysela, Takashi Iwai, open list
Convert acp-pci to the pcim-managed PCI life-cycle. Replace
pci_enable_device() with pcim_enable_device() and fold the
open-coded pci_request_regions() + devm_ioremap() pair into a single
pcim_iomap_region() call for BAR0, which reserves and iomaps the
register window.
This lets the driver drop the manual pci_release_regions() and
pci_disable_device() calls from the probe error path; pcim releases
the device and region automatically on detach or probe failure. The
error check moves from a NULL test to IS_ERR(), since pcim_iomap_region()
returns an IOMEM_ERR_PTR on failure.
The child platform devices only use devm_ioremap() on their sub-range
of BAR0 (no request_mem_region), so reserving the full BAR0 here does
not conflict with them.
Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
sound/soc/amd/acp/acp-pci.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c
index f83708755ed1..98771323eace 100644
--- a/sound/soc/amd/acp/acp-pci.c
+++ b/sound/soc/amd/acp/acp-pci.c
@@ -118,17 +118,10 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
if (!chip)
return -ENOMEM;
- if (pci_enable_device(pci))
+ if (pcim_enable_device(pci))
return dev_err_probe(&pci->dev, -ENODEV,
"pci_enable_device failed\n");
- ret = pci_request_regions(pci, "AMD ACP3x audio");
- if (ret < 0) {
- dev_err(&pci->dev, "pci_request_regions failed\n");
- ret = -ENOMEM;
- goto disable_pci;
- }
-
pci_set_master(pci);
chip->acp_rev = pci->revision;
@@ -161,24 +154,21 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
break;
default:
dev_err(dev, "Unsupported device revision:0x%x\n", pci->revision);
- ret = -EINVAL;
- goto release_regions;
+ return -EINVAL;
}
chip->flag = flag;
addr = pci_resource_start(pci, 0);
- chip->base = devm_ioremap(&pci->dev, addr, pci_resource_len(pci, 0));
- if (!chip->base) {
- ret = -ENOMEM;
- goto release_regions;
- }
+ chip->base = pcim_iomap_region(pci, 0, "AMD ACP3x audio");
+ if (IS_ERR(chip->base))
+ return PTR_ERR(chip->base);
chip->addr = addr;
chip->acp_hw_ops_init(chip);
ret = acp_hw_init(chip);
if (ret)
- goto release_regions;
+ goto de_init;
ret = devm_request_irq(dev, pci->irq, irq_handler,
IRQF_SHARED, "ACP_I2S_IRQ", chip);
@@ -214,10 +204,6 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
de_init:
acp_hw_deinit(chip);
-release_regions:
- pci_release_regions(pci);
-disable_pci:
- pci_disable_device(pci);
return ret;
};
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: amd: acp: Use pcim_iomap_region() in acp-pci
2026-07-20 0:10 [PATCH] ASoC: amd: acp: Use pcim_iomap_region() in acp-pci Rosen Penev
@ 2026-08-01 1:02 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-08-01 1:02 UTC (permalink / raw)
To: linux-sound, Rosen Penev
Cc: Vijendar Mukunda, Venkata Prasad Potturu, Liam Girdwood,
Jaroslav Kysela, Takashi Iwai, linux-kernel
On Sun, 19 Jul 2026 17:10:54 -0700, Rosen Penev wrote:
> ASoC: amd: acp: Use pcim_iomap_region() in acp-pci
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3
Thanks!
[1/1] ASoC: amd: acp: Use pcim_iomap_region() in acp-pci
https://git.kernel.org/broonie/sound/c/596f78db1952
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-01 1:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 0:10 [PATCH] ASoC: amd: acp: Use pcim_iomap_region() in acp-pci Rosen Penev
2026-08-01 1:02 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox