Skip to contentSkip to conversation

sound: Replace deprecated PCI functions

PATCH In review Philipp Stanner 4 participants 18 messages Apr 4, 2025 – Apr 8, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover sound: Replace deprecated PCI functions

pcim_iomap_table() and pcim_iomap_regions() have been deprecated by the PCI subsystem. In sound/, they can easily be replaced with pcim_iomap_region().

This series was around some time in late summer last year as a single patch. I lost track of it for a while, but Takashi Iwai (AFAIR) requested that I split it by component.

So that's being done here. Feel free to squash the patches as you like.

P.

Philipp Stanner (11):
ALSA: ad1889: Replace deprecated PCI functions
ALSA: atiixp: Replace deprecated PCI functions
ALSA: au88x0: Replace deprecated PCI functions
ALSA: aw2: Replace deprecated PCI functions
ALSA: bt87x: Replace deprecated PCI functions
ALSA: cs4281: Replace deprecated PCI functions
ALSA: hda_intel: Replace deprecated PCI functions
ALSA: cs5530: Replace deprecated PCI functions
ALSA: lola: Replace deprecated PCI functions
ALSA: hdspm: Replace deprecated PCI functions
ASoC: loongson: Replace deprecated PCI functions

 sound/pci/ad1889.c                    |  7 +++----
 sound/pci/atiixp.c                    |  7 +++----
 sound/pci/atiixp_modem.c              |  7 +++----
 sound/pci/au88x0/au88x0.c             |  7 +++----
 sound/pci/aw2/aw2-alsa.c              |  7 +++----
 sound/pci/bt87x.c                     |  7 +++----
 sound/pci/cs4281.c                    | 13 +++++++------
 sound/pci/cs5530.c                    |  7 +++----
 sound/pci/hda/hda_intel.c             |  7 +++----
 sound/pci/lola/lola.c                 | 16 +++++++++++-----
 sound/pci/rme9652/hdspm.c             |  7 +++----
 sound/soc/loongson/loongson_i2s_pci.c | 13 +++++++------
 12 files changed, 52 insertions(+), 53 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/11 ALSA: ad1889: Replace deprecated PCI functions

pcim_iomap_table() and pcim_iomap_regions() have been deprecated.

Replace them with pcim_iomap_region().

---
 sound/pci/ad1889.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/pci/ad1889.c +3 -4
index 9ed778b6b03c..ac27a93ce4ff 100644
@@ -810,12 +810,11 @@ snd_ad1889_create(struct snd_card *card, struct pci_dev *pci)
 	chip->irq = -1;
 
 	/* (1) PCI resource allocation */
-	err = pcim_iomap_regions(pci, 1 << 0, card->driver);
-	if (err < 0)
-		return err;
+	chip->iobase = pcim_iomap_region(pci, 0, card->driver);
+	if (IS_ERR(chip->iobase))
+		return PTR_ERR(chip->iobase);
 
 	chip->bar = pci_resource_start(pci, 0);
-	chip->iobase = pcim_iomap_table(pci)[0];
 	
 	pci_set_master(pci);
 
Signature · 1 line
2.48.1
#2 lore raw

PATCH 2/11 ALSA: atiixp: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

---
 sound/pci/atiixp.c       | 7 +++----
 sound/pci/atiixp_modem.c | 7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)
sound/pci/atiixp.c +3 -4
index df2fef726d60..427006be240b 100644
@@ -1544,11 +1544,10 @@ static int snd_atiixp_init(struct snd_card *card, struct pci_dev *pci)
 	chip->card = card;
 	chip->pci = pci;
 	chip->irq = -1;
-	err = pcim_iomap_regions(pci, 1 << 0, "ATI IXP AC97");
-	if (err < 0)
-		return err;
+	chip->remap_addr = pcim_iomap_region(pci, 0, "ATI IXP AC97");
+	if (IS_ERR(chip->remap_addr))
+		return PTR_ERR(chip->remap_addr);
 	chip->addr = pci_resource_start(pci, 0);
-	chip->remap_addr = pcim_iomap_table(pci)[0];
 
 	if (devm_request_irq(&pci->dev, pci->irq, snd_atiixp_interrupt,
 			     IRQF_SHARED, KBUILD_MODNAME, chip)) {
sound/pci/atiixp_modem.c +3 -4
index eb569539f322..8d3083b9b024 100644
@@ -1174,11 +1174,10 @@ static int snd_atiixp_init(struct snd_card *card, struct pci_dev *pci)
 	chip->card = card;
 	chip->pci = pci;
 	chip->irq = -1;
-	err = pcim_iomap_regions(pci, 1 << 0, "ATI IXP MC97");
-	if (err < 0)
-		return err;
+	chip->remap_addr = pcim_iomap_region(pci, 0, "ATI IXP MC97");
+	if (IS_ERR(chip->remap_addr))
+		return PTR_ERR(chip->remap_addr);
 	chip->addr = pci_resource_start(pci, 0);
-	chip->remap_addr = pcim_iomap_table(pci)[0];
 
 	if (devm_request_irq(&pci->dev, pci->irq, snd_atiixp_interrupt,
 			     IRQF_SHARED, KBUILD_MODNAME, chip)) {
Signature · 1 line
2.48.1
#3 lore raw

PATCH 3/11 ALSA: au88x0: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

Additionally, the "name" parameter of pcim_iomap_region() should reflect the driver's, not the hardware's, name. Pass the correct parameter.

---
 sound/pci/au88x0/au88x0.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/pci/au88x0/au88x0.c +3 -4
index 62b10b0e07b1..fd986247331a 100644
@@ -160,12 +160,11 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci)
 	// (1) PCI resource allocation
 	// Get MMIO area
 	//
-	err = pcim_iomap_regions(pci, 1 << 0, CARD_NAME_SHORT);
-	if (err)
-		return err;
+	chip->mmio = pcim_iomap_region(pci, 0, KBUILD_MODNAME);
+	if (IS_ERR(chip->mmio))
+		return PTR_ERR(chip->mmio);
 
 	chip->io = pci_resource_start(pci, 0);
-	chip->mmio = pcim_iomap_table(pci)[0];
 
 	/* Init audio core.
 	 * This must be done before we do request_irq otherwise we can get spurious
Signature · 1 line
2.48.1
#4 lore raw

PATCH 4/11 ALSA: aw2: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

---
 sound/pci/aw2/aw2-alsa.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/pci/aw2/aw2-alsa.c +3 -4
index 29a4bcdec237..7b4b8f785517 100644
@@ -225,11 +225,10 @@ static int snd_aw2_create(struct snd_card *card,
 	chip->irq = -1;
 
 	/* (1) PCI resource allocation */
-	err = pcim_iomap_regions(pci, 1 << 0, "Audiowerk2");
-	if (err < 0)
-		return err;
+	chip->iobase_virt = pcim_iomap_region(pci, 0, "Audiowerk2");
+	if (IS_ERR(chip->iobase_virt))
+		return PTR_ERR(chip->iobase_virt);
 	chip->iobase_phys = pci_resource_start(pci, 0);
-	chip->iobase_virt = pcim_iomap_table(pci)[0];
 
 	/* (2) initialization of the chip hardware */
 	snd_aw2_saa7146_setup(&chip->saa7146, chip->iobase_virt);
Signature · 1 line
2.48.1
#5 lore raw

PATCH 5/11 ALSA: bt87x: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

---
 sound/pci/bt87x.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/pci/bt87x.c +3 -4
index 621985bfee5d..91492dd2b38a 100644
@@ -696,10 +696,9 @@ static int snd_bt87x_create(struct snd_card *card,
 	chip->irq = -1;
 	spin_lock_init(&chip->reg_lock);
 
-	err = pcim_iomap_regions(pci, 1 << 0, "Bt87x audio");
-	if (err < 0)
-		return err;
-	chip->mmio = pcim_iomap_table(pci)[0];
+	chip->mmio = pcim_iomap_region(pci, 0, "Bt87x audio");
+	if (IS_ERR(chip->mmio))
+		return PTR_ERR(chip->mmio);
 
 	chip->reg_control = CTL_A_PWRDN | CTL_DA_ES2 |
 			    CTL_PKTP_16 | (15 << CTL_DA_SDR_SHIFT);
Signature · 1 line
2.48.1
#6 lore raw

PATCH 6/11 ALSA: cs4281: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

---
 sound/pci/cs4281.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
sound/pci/cs4281.c +7 -6
index 0cc86e73cc62..90958a422b75 100644
@@ -1302,14 +1302,15 @@ static int snd_cs4281_create(struct snd_card *card,
 	}
 	chip->dual_codec = dual_codec;
 
-	err = pcim_iomap_regions(pci, 0x03, "CS4281"); /* 2 BARs */
-	if (err < 0)
-		return err;
+	chip->ba0 = pcim_iomap_region(pci, 0, "CS4281");
+	if (IS_ERR(chip->ba0))
+		return PTR_ERR(chip->ba0);
 	chip->ba0_addr = pci_resource_start(pci, 0);
-	chip->ba1_addr = pci_resource_start(pci, 1);
 
-	chip->ba0 = pcim_iomap_table(pci)[0];
-	chip->ba1 = pcim_iomap_table(pci)[1];
+	chip->ba1 = pcim_iomap_region(pci, 1, "CS4281");
+	if (IS_ERR(chip->ba1))
+		return PTR_ERR(chip->ba1);
+	chip->ba1_addr = pci_resource_start(pci, 1);
 	
 	if (devm_request_irq(&pci->dev, pci->irq, snd_cs4281_interrupt,
 			     IRQF_SHARED, KBUILD_MODNAME, chip)) {
Signature · 1 line
2.48.1
#7 lore raw

PATCH 7/11 ALSA: hda_intel: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

---
 sound/pci/hda/hda_intel.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/pci/hda/hda_intel.c +3 -4
index 512fb22f5e5e..9756017930b5 100644
@@ -1877,12 +1877,11 @@ static int azx_first_init(struct azx *chip)
 			chip->jackpoll_interval = msecs_to_jiffies(1500);
 	}
 
-	err = pcim_iomap_regions(pci, 1 << 0, "ICH HD audio");
-	if (err < 0)
-		return err;
+	bus->remap_addr = pcim_iomap_region(pci, 0, "ICH HD audio");
+	if (IS_ERR(bus->remap_addr))
+		return PTR_ERR(bus->remap_addr);
 
 	bus->addr = pci_resource_start(pci, 0);
-	bus->remap_addr = pcim_iomap_table(pci)[0];
 
 	if (chip->driver_type == AZX_DRIVER_SKL)
 		snd_hdac_bus_parse_capabilities(bus);
Signature · 1 line
2.48.1
#8 lore raw

PATCH 8/11 ALSA: cs5530: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

---
 sound/pci/cs5530.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/pci/cs5530.c +3 -4
index 93ff029e6583..532891e67c34 100644
@@ -91,11 +91,10 @@ static int snd_cs5530_create(struct snd_card *card,
 	chip->card = card;
 	chip->pci = pci;
 
-	err = pcim_iomap_regions(pci, 1 << 0, "CS5530");
-	if (err < 0)
-		return err;
+	mem = pcim_iomap_region(pci, 0, "CS5530");
+	if (IS_ERR(mem))
+		return PTR_ERR(mem);
 	chip->pci_base = pci_resource_start(pci, 0);
-	mem = pcim_iomap_table(pci)[0];
 	map = readw(mem + 0x18);
 
 	/* Map bits
Signature · 1 line
2.48.1
#9 lore raw

PATCH 9/11 ALSA: lola: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

---
 sound/pci/lola/lola.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
sound/pci/lola/lola.c +11 -5
index 1aa30e90b86a..fb8bd54e4c2d 100644
@@ -541,6 +541,7 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci, int dev)
 	struct lola *chip = card->private_data;
 	int err;
 	unsigned int dever;
+	void __iomem *iomem;
 
 	err = pcim_enable_device(pci);
 	if (err < 0)
@@ -580,14 +581,19 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci, int dev)
 		chip->sample_rate_min = 16000;
 	}
 
-	err = pcim_iomap_regions(pci, (1 << 0) | (1 << 2), DRVNAME);
-	if (err < 0)
-		return err;
+	iomem = pcim_iomap_region(pci, 0, DRVNAME);
+	if (IS_ERR(iomem))
+		return PTR_ERR(iomem);
 
+	chip->bar[0].remap_addr = iomem;
 	chip->bar[0].addr = pci_resource_start(pci, 0);
-	chip->bar[0].remap_addr = pcim_iomap_table(pci)[0];
+
+	iomem = pcim_iomap_region(pci, 2, DRVNAME);
+	if (IS_ERR(iomem))
+		return PTR_ERR(iomem);
+
+	chip->bar[1].remap_addr = iomem;
 	chip->bar[1].addr = pci_resource_start(pci, 2);
-	chip->bar[1].remap_addr = pcim_iomap_table(pci)[2];
 
 	pci_set_master(pci);
 
Signature · 1 line
2.48.1
#10 lore raw

PATCH 10/11 ALSA: hdspm: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

---
 sound/pci/rme9652/hdspm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/pci/rme9652/hdspm.c +3 -4
index f89718b19d23..9e11e60284eb 100644
@@ -6558,13 +6558,12 @@ static int snd_hdspm_create(struct snd_card *card,
 
 	pci_set_master(hdspm->pci);
 
-	err = pcim_iomap_regions(pci, 1 << 0, "hdspm");
-	if (err < 0)
-		return err;
+	hdspm->iobase = pcim_iomap_region(pci, 0, "hdspm");
+	if (IS_ERR(hdspm->iobase))
+		return PTR_ERR(hdspm->iobase);
 
 	hdspm->port = pci_resource_start(pci, 0);
 	io_extent = pci_resource_len(pci, 0);
-	hdspm->iobase = pcim_iomap_table(pci)[0];
 	dev_dbg(card->dev, "remapped region (0x%lx) 0x%lx-0x%lx\n",
 			(unsigned long)hdspm->iobase, hdspm->port,
 			hdspm->port + io_extent - 1);
Signature · 1 line
2.48.1
#11 lore raw

PATCH 11/11 ASoC: loongson: Replace deprecated PCI functions

In reply to Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().

---
 sound/soc/loongson/loongson_i2s_pci.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
sound/soc/loongson/loongson_i2s_pci.c +7 -6
index d2d0e5d8cac9..1ea5501a97f8 100644
@@ -16,6 +16,8 @@
 #include "loongson_i2s.h"
 #include "loongson_dma.h"
 
+#define DRIVER_NAME "loongson-i2s-pci"
+
 static bool loongson_i2s_wr_reg(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
@@ -92,13 +94,12 @@ static int loongson_i2s_pci_probe(struct pci_dev *pdev,
 	i2s->dev = dev;
 	pci_set_drvdata(pdev, i2s);
 
-	ret = pcim_iomap_regions(pdev, 1 << 0, dev_name(dev));
-	if (ret < 0) {
-		dev_err(dev, "iomap_regions failed\n");
-		return ret;
+	i2s->reg_base = pcim_iomap_region(pdev, 0, DRIVER_NAME);
+	if (IS_ERR(i2s->reg_base)) {
+		dev_err(dev, "iomap_region failed\n");
+		return PTR_ERR(i2s->reg_base);
 	}
 
-	i2s->reg_base = pcim_iomap_table(pdev)[0];
 	i2s->regmap = devm_regmap_init_mmio(dev, i2s->reg_base,
 					    &loongson_i2s_regmap_config);
 	if (IS_ERR(i2s->regmap))
@@ -147,7 +148,7 @@ static const struct pci_device_id loongson_i2s_ids[] = {
 MODULE_DEVICE_TABLE(pci, loongson_i2s_ids);
 
 static struct pci_driver loongson_i2s_driver = {
-	.name = "loongson-i2s-pci",
+	.name = DRIVER_NAME,
 	.id_table = loongson_i2s_ids,
 	.probe = loongson_i2s_pci_probe,
 	.driver = {
Signature · 1 line
2.48.1
#12 lore raw
In reply to Philipp Stanner
Quoted 10 lines · Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated by the PCI subsystem. In sound/, they can easily be replaced with pcim_iomap_region().

This series was around some time in late summer last year as a single patch. I lost track of it for a while, but Takashi Iwai (AFAIR) requested that I split it by component.

So that's being done here. Feel free to squash the patches as you like.

Thanks for the patches. I suppose those are no urgent fixes, and can be postponed for 6.16? If so, I'll pick them up after 6.15-rc1 merge window is closed.

Takashi

#13 lore raw
Quoted 13 lines · Takashi Iwai
Quoted 11 lines · Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated by the
PCI subsystem. In sound/, they can easily be replaced with pcim_iomap_region().

This series was around some time in late summer last year as a single
patch. I lost track of it for a while, but Takashi Iwai (AFAIR) requested that I split it by component.

Quoted 6 lines
Quoted 2 lines

So that's being done here. Feel free to squash the patches as you like.

Thanks for the patches.  I suppose those are no urgent fixes, and can be postponed for 6.16?  If so, I'll pick them up after 6.15-rc1 merge window is closed.

Sure, those are just improvements that aren't urgent.

Thx,
P.

Quoted 3 lines

Takashi

#14 lore raw
Quoted 15 lines · Philipp Stanner
Quoted 13 lines · Takashi Iwai
Quoted 11 lines · Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated by the
PCI subsystem. In sound/, they can easily be replaced with pcim_iomap_region().

This series was around some time in late summer last year as a single
patch. I lost track of it for a while, but Takashi Iwai (AFAIR) requested that I split it by component.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

So that's being done here. Feel free to squash the patches as you like.

Thanks for the patches.  I suppose those are no urgent fixes, and can be postponed for 6.16?  If so, I'll pick them up after 6.15-rc1 merge window is closed.

Sure, those are just improvements that aren't urgent.

Now all patches applied to for-next branch. Thanks.

Takashi

maintainer
#15 lore raw

Re: (subset) [PATCH 00/11] sound: Replace deprecated PCI functions

In reply to Philipp Stanner
Quoted 9 lines · Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated by the PCI subsystem. In sound/, they can easily be replaced with pcim_iomap_region().

This series was around some time in late summer last year as a single patch. I lost track of it for a while, but Takashi Iwai (AFAIR) requested that I split it by component.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[11/11] ASoC: loongson: Replace deprecated PCI functions

        commit: 7288aa73e5cfb3f37ae93b55d7b7d63eca5140a8

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

#16 lore raw

Re: (subset) [PATCH 00/11] sound: Replace deprecated PCI functions

Quoted 30 lines · Mark Brown
Quoted 9 lines · Philipp Stanner

pcim_iomap_table() and pcim_iomap_regions() have been deprecated by the PCI subsystem. In sound/, they can easily be replaced with pcim_iomap_region().

This series was around some time in late summer last year as a single patch. I lost track of it for a while, but Takashi Iwai (AFAIR) requested that I split it by component.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[11/11] ASoC: loongson: Replace deprecated PCI functions

        commit: 7288aa73e5cfb3f37ae93b55d7b7d63eca5140a8

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.

Quoted 6 lines

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.

Oh, I already applied this one blindly as a part of series to my tree. But it's a trivial fix and shouldn't be a big problem to apply twice...

Takashi

maintainer
#17 lore raw

Re: (subset) [PATCH 00/11] sound: Replace deprecated PCI functions

Quoted 8 lines · Takashi Iwai
Quoted 2 lines · Mark Brown

[11/11] ASoC: loongson: Replace deprecated PCI functions

        commit: 7288aa73e5cfb3f37ae93b55d7b7d63eca5140a8

Oh, I already applied this one blindly as a part of series to my tree. But it's a trivial fix and shouldn't be a big problem to apply twice...

Yeah, I saw you applied it after it was already well down the pipeline in a branch in my CI and thought it'd be fine if we ended up with two copies.