sound: Phase out hybrid PCI devres API
Subsystems (6)
cover sound: Phase out hybrid PCI devres API
Hi,
a year ago we spent quite some work trying to get PCI into better shape. Some pci_ functions can be sometimes managed with devres, which is obviously bad. We want to provide an obvious API, where pci_ functions are never, and pcim_ functions are always managed.
Thus, everyone enabling his device with pcim_enable_device() must be ported to pcim_ functions. Porting all users will later enable us to significantly simplify parts of the PCI subsystem. See here [1] for details.
This patch series does that for sound.
Feel free to squash the commits as you see fit.
P.
[1] https://elixir.bootlin.com/linux/v6.14-rc4/source/drivers/pci/devres.c#L18
Philipp Stanner (31):
ASoC: sof: Use pure devres PCI
ASoC: intel/avs: Use pure devres PCI
AsoC: intel/atom: Use pure devres PCI
ALSA: sonicvibes: Use pure devres PCI
ALSA: rme96: Use pure devres PCI
ALSA: rme32: Use pure devres PCI
ALSA: ens1370: Use pure devres PCI
ALSA: cmipci: Use pure devres PCI
ALSA: via82: Use pure devres PCI
ALSA: sis7019: Use pure devres PCI
ALSA: intel8x: Use pure devres PCI
ALSA: fm801: Use pure devres PCI
ALSA: es19x8: Use pure devres PCI
ALSA: azt3328: Use pure devres PCI
ALSA: als: Use pure devres PCI
ALSA: oxygen: Use pure devres PCI
ALSA: lx6464es: Use pure devres PCI
ALSA: vx222: Use pure devres PCI
ALSA: trident: Use pure devres PCI
ALSA: rme9652: Use pure devres PCI
ALSA: ymfpci: Use pure devres PCI
ALSA: riptide: Use pure devres PCI
ALSA: nm256: Use pure devres PCI
ALSA: ice: Use pure devres PCI
ALSA: emu10k1: Use pure devres PCI
ALSA: echoaudio: Use pure devres PCI
ALSA: cs5535: Use pure devres PCI
ALSA: cs46xx: Use pure devres PCI
ALSA: ca0106: Use pure devres PCI
ALSA: ali5451: Use pure devres PCI
ALSA: maestro3: Use pure devres PCI
sound/pci/ali5451/ali5451.c | 2 +- sound/pci/als300.c | 2 +- sound/pci/als4000.c | 2 +- sound/pci/azt3328.c | 2 +- sound/pci/ca0106/ca0106_main.c | 2 +- sound/pci/cmipci.c | 2 +- sound/pci/cs46xx/cs46xx_lib.c | 2 +- sound/pci/cs5535audio/cs5535audio.c | 2 +- sound/pci/echoaudio/echoaudio.c | 2 +- sound/pci/emu10k1/emu10k1_main.c | 2 +- sound/pci/emu10k1/emu10k1x.c | 2 +- sound/pci/ens1370.c | 2 +- sound/pci/es1938.c | 2 +- sound/pci/es1968.c | 2 +- sound/pci/fm801.c | 2 +- sound/pci/ice1712/ice1712.c | 2 +- sound/pci/ice1712/ice1724.c | 2 +- sound/pci/intel8x0.c | 2 +- sound/pci/intel8x0m.c | 2 +- sound/pci/lx6464es/lx6464es.c | 2 +- sound/pci/maestro3.c | 2 +- sound/pci/nm256/nm256.c | 2 +- sound/pci/oxygen/oxygen_lib.c | 2 +- sound/pci/riptide/riptide.c | 2 +- sound/pci/rme32.c | 2 +- sound/pci/rme96.c | 2 +- sound/pci/rme9652/hdsp.c | 2 +- sound/pci/rme9652/rme9652.c | 2 +- sound/pci/sis7019.c | 2 +- sound/pci/sonicvibes.c | 2 +- sound/pci/trident/trident_main.c | 2 +- sound/pci/via82xx.c | 2 +- sound/pci/via82xx_modem.c | 2 +- sound/pci/vx222/vx222.c | 2 +- sound/pci/ymfpci/ymfpci_main.c | 2 +- sound/soc/intel/atom/sst/sst_pci.c | 56 ++++++++++++----------------- sound/soc/intel/avs/core.c | 7 ++-- sound/soc/sof/sof-pci-dev.c | 12 ++----- 38 files changed, 62 insertions(+), 83 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/31 ASoC: sof: Use pure devres PCI
pci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
Remove surplus calls to PCI release functions, since pcim_ functions do cleanup automatically.
--- sound/soc/sof/sof-pci-dev.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
sound/soc/sof/sof-pci-dev.c +2 -10
@@ -216,7 +216,7 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)if (ret <0 )return ret; - ret =pci_request_regions (pci,"Audio DSP" ); + ret =pcim_request_all_regions (pci,"Audio DSP" );if (ret <0 )return ret;
@@ -240,8 +240,7 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) path_override->ipc_type = sof_pci_ipc_type; }else {dev_err (dev,"Invalid IPC type requested: %d\n" , sof_pci_ipc_type); - ret = -EINVAL ; - goto out; +return -EINVAL ; } path_override->fw_path = fw_path;
@@ -273,10 +272,6 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)/* call sof helper for DSP hardware probe */ ret =snd_sof_device_probe (dev, sof_pdata); -out: -if (ret) -pci_release_regions (pci); -return ret; }EXPORT_SYMBOL_NS (sof_pci_probe,"SND_SOC_SOF_PCI_DEV" );
@@ -290,9 +285,6 @@ void sof_pci_remove(struct pci_dev *pci)if (snd_sof_device_probe_completed (&pci->dev) && !(sof_pci_debug &SOF_PCI_DISABLE_PM_RUNTIME ))pm_runtime_get_noresume (&pci->dev); - -/* release pci regions and disable device */ -pci_release_regions (pci); }EXPORT_SYMBOL_NS (sof_pci_remove,"SND_SOC_SOF_PCI_DEV" );
Signature · 1 line
2.48.1
PATCH 2/31 ASoC: intel/avs: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
Remove the goto jump to pci_release_regions(), since pcim_ functions clean up automatically.
--- sound/soc/intel/avs/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
sound/soc/intel/avs/core.c +2 -5
@@ -445,7 +445,7 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)return ret; } - ret =pci_request_regions (pci,"AVS HDAudio" ); + ret =pcim_request_all_regions (pci,"AVS HDAudio" );if (ret <0 )return ret;
@@ -454,8 +454,7 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) bus->remap_addr =pci_ioremap_bar (pci,0 );if (!bus->remap_addr) {dev_err (bus->dev,"ioremap error\n" ); - ret = -ENXIO ; - goto err_remap_bar0; +return -ENXIO ; } adev->dsp_ba =pci_ioremap_bar (pci,4 );
@@ -512,8 +511,6 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)iounmap (adev->dsp_ba); err_remap_bar4:iounmap (bus->remap_addr); -err_remap_bar0: -pci_release_regions (pci);return ret; }
Signature · 1 line
2.48.1
PATCH 3/31 AsoC: intel/atom: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
Remove the call to pci_release_regions(), since pcim_ functions do cleanup automatically.
Pass 0 as length parameter to pcim_iomap(), which is the standard way for ioremapping an entire BAR.
--- sound/soc/intel/atom/sst/sst_pci.c | 56 ++++++++++++------------------ 1 file changed, 23 insertions(+), 33 deletions(-)
sound/soc/intel/atom/sst/sst_pci.c +23 -33
@@ -26,7 +26,7 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)int ddr_base, ret =0 ;struct pci_dev *pci = ctx->pci; - ret =pci_request_regions (pci,SST_DRV_NAME ); + ret =pcim_request_all_regions (pci,SST_DRV_NAME );if (ret)return ret;
@@ -38,66 +38,56 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx) ddr_base =relocate_imr_addr_mrfld (ctx->ddr_base);if (!ctx->pdata->lib_info) {dev_err (ctx->dev,"lib_info pointer NULL\n" ); - ret = -EINVAL ; - goto do_release_regions; +return -EINVAL ; }if (ddr_base != ctx->pdata->lib_info->mod_base) {dev_err (ctx->dev,"FW LSP DDR BASE does not match with IFWI\n" ); - ret = -EINVAL ; - goto do_release_regions; +return -EINVAL ; } ctx->ddr_end =pci_resource_end (pci,0 ); - ctx->ddr =pcim_iomap (pci,0 , -pci_resource_len (pci,0 )); -if (!ctx->ddr) { - ret = -EINVAL ; - goto do_release_regions; - } + ctx->ddr =pcim_iomap (pci,0 ,0 ); +if (!ctx->ddr) +return -EINVAL ; +dev_dbg (ctx->dev,"sst: DDR Ptr %p\n" , ctx->ddr); }else { ctx->ddr =NULL ; }/* SHIM */ ctx->shim_phy_add =pci_resource_start (pci,1 ); - ctx->shim =pcim_iomap (pci,1 ,pci_resource_len (pci,1 )); -if (!ctx->shim) { - ret = -EINVAL ; - goto do_release_regions; - } + ctx->shim =pcim_iomap (pci,1 ,0 ); +if (!ctx->shim) +return -EINVAL ; +dev_dbg (ctx->dev,"SST Shim Ptr %p\n" , ctx->shim);/* Shared SRAM */ ctx->mailbox_add =pci_resource_start (pci,2 ); - ctx->mailbox =pcim_iomap (pci,2 ,pci_resource_len (pci,2 )); -if (!ctx->mailbox) { - ret = -EINVAL ; - goto do_release_regions; - } + ctx->mailbox =pcim_iomap (pci,2 ,0 ); +if (!ctx->mailbox) +return -EINVAL ; +dev_dbg (ctx->dev,"SRAM Ptr %p\n" , ctx->mailbox);/* IRAM */ ctx->iram_end =pci_resource_end (pci,3 ); ctx->iram_base =pci_resource_start (pci,3 ); - ctx->iram =pcim_iomap (pci,3 ,pci_resource_len (pci,3 )); -if (!ctx->iram) { - ret = -EINVAL ; - goto do_release_regions; - } + ctx->iram =pcim_iomap (pci,3 ,0 ); +if (!ctx->iram) +return -EINVAL ; +dev_dbg (ctx->dev,"IRAM Ptr %p\n" , ctx->iram);/* DRAM */ ctx->dram_end =pci_resource_end (pci,4 ); ctx->dram_base =pci_resource_start (pci,4 ); - ctx->dram =pcim_iomap (pci,4 ,pci_resource_len (pci,4 )); -if (!ctx->dram) { - ret = -EINVAL ; - goto do_release_regions; - } + ctx->dram =pcim_iomap (pci,4 ,0 ); +if (!ctx->dram) +return -EINVAL ; +dev_dbg (ctx->dev,"DRAM Ptr %p\n" , ctx->dram); -do_release_regions: -pci_release_regions (pci);return ret; }
Signature · 1 line
2.48.1
PATCH 4/31 ALSA: sonicvibes: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/sonicvibes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/sonicvibes.c +1 -1
@@ -1227,7 +1227,7 @@ static int snd_sonicvibes_create(struct snd_card *card, sonic->pci = pci; sonic->irq =-1 ; - err =pci_request_regions (pci,"S3 SonicVibes" ); + err =pcim_request_all_regions (pci,"S3 SonicVibes" );if (err <0 )return err;
Signature · 1 line
2.48.1
PATCH 5/31 ALSA: rme96: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/rme96.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/rme96.c +1 -1
@@ -1575,7 +1575,7 @@ snd_rme96_create(struct rme96 *rme96)if (err <0 )return err; - err =pci_request_regions (pci,"RME96" ); + err =pcim_request_all_regions (pci,"RME96" );if (err <0 )return err; rme96->port =pci_resource_start (rme96->pci,0 );
Signature · 1 line
2.48.1
PATCH 6/31 ALSA: rme32: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/rme32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/rme32.c +1 -1
@@ -1284,7 +1284,7 @@ static int snd_rme32_create(struct rme32 *rme32)if (err <0 )return err; - err =pci_request_regions (pci,"RME32" ); + err =pcim_request_all_regions (pci,"RME32" );if (err <0 )return err; rme32->port =pci_resource_start (rme32->pci,0 );
Signature · 1 line
2.48.1
PATCH 7/31 ALSA: ens1370: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/ens1370.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/ens1370.c +1 -1
@@ -2022,7 +2022,7 @@ static int snd_ensoniq_create(struct snd_card *card, ensoniq->card = card; ensoniq->pci = pci; ensoniq->irq =-1 ; - err =pci_request_regions (pci,"Ensoniq AudioPCI" ); + err =pcim_request_all_regions (pci,"Ensoniq AudioPCI" );if (err <0 )return err; ensoniq->port =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 8/31 ALSA: cmipci: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/cmipci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/cmipci.c +1 -1
@@ -2980,7 +2980,7 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci, cm->channel[1 ].ch =1 ; cm->channel[0 ].is_dac = cm->channel[1 ].is_dac =1 ;/* dual DAC mode */ - err =pci_request_regions (pci, card->driver); + err =pcim_request_all_regions (pci, card->driver);if (err <0 )return err; cm->iobase =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 9/31 ALSA: via82: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/via82xx.c | 2 +- sound/pci/via82xx_modem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/via82xx.c +1 -1
@@ -2326,7 +2326,7 @@ static int snd_via82xx_create(struct snd_card *card,pci_write_config_byte (chip->pci,VIA_FUNC_ENABLE , chip->old_legacy & ~(VIA_FUNC_ENABLE_SB |VIA_FUNC_ENABLE_FM )); - err =pci_request_regions (pci, card->driver); + err =pcim_request_all_regions (pci, card->driver);if (err <0 )return err; chip->port =pci_resource_start (pci,0 );
sound/pci/via82xx_modem.c +1 -1
@@ -1071,7 +1071,7 @@ static int snd_via82xx_create(struct snd_card *card, chip->pci = pci; chip->irq =-1 ; - err =pci_request_regions (pci, card->driver); + err =pcim_request_all_regions (pci, card->driver);if (err <0 )return err; chip->port =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 10/31 ALSA: sis7019: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/sis7019.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/sis7019.c +1 -1
@@ -1273,7 +1273,7 @@ static int sis_chip_create(struct snd_card *card, sis->irq =-1 ; sis->ioport =pci_resource_start (pci,0 ); - rc =pci_request_regions (pci,"SiS7019" ); + rc =pcim_request_all_regions (pci,"SiS7019" );if (rc) {dev_err (&pci->dev,"unable request regions\n" );return rc;
Signature · 1 line
2.48.1
PATCH 11/31 ALSA: intel8x: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/intel8x0.c | 2 +- sound/pci/intel8x0m.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/intel8x0.c +1 -1
@@ -2926,7 +2926,7 @@ static int snd_intel8x0_init(struct snd_card *card, pci->device == PCI_DEVICE_ID_INTEL_440MX) chip->fix_nocache = 1; /* enable workaround */ - err =pci_request_regions (pci, card->shortname); + err =pcim_request_all_regions (pci, card->shortname);if (err <0 )return err;
sound/pci/intel8x0m.c +1 -1
@@ -1060,7 +1060,7 @@ static int snd_intel8x0m_init(struct snd_card *card, chip->pci = pci; chip->irq =-1 ; - err =pci_request_regions (pci, card->shortname); + err =pcim_request_all_regions (pci, card->shortname);if (err <0 )return err;
Signature · 1 line
2.48.1
PATCH 12/31 ALSA: fm801: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/fm801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/fm801.c +1 -1
@@ -1191,7 +1191,7 @@ static int snd_fm801_create(struct snd_card *card, chip->dev = &pci->dev; chip->irq =-1 ; chip->tea575x_tuner = tea575x_tuner; - err =pci_request_regions (pci,"FM801" ); + err =pcim_request_all_regions (pci,"FM801" );if (err <0 )return err; chip->port =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 13/31 ALSA: es19x8: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/es1938.c | 2 +- sound/pci/es1968.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/es1938.c +1 -1
@@ -1531,7 +1531,7 @@ static int snd_es1938_create(struct snd_card *card, chip->card = card; chip->pci = pci; chip->irq =-1 ; - err =pci_request_regions (pci,"ESS Solo-1" ); + err =pcim_request_all_regions (pci,"ESS Solo-1" );if (err <0 )return err; chip->io_port =pci_resource_start (pci,0 );
sound/pci/es1968.c +1 -1
@@ -2647,7 +2647,7 @@ static int snd_es1968_create(struct snd_card *card, chip->playback_streams = play_streams; chip->capture_streams = capt_streams; - err =pci_request_regions (pci,"ESS Maestro" ); + err =pcim_request_all_regions (pci,"ESS Maestro" );if (err <0 )return err; chip->io_port =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 14/31 ALSA: azt3328: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/azt3328.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/azt3328.c +1 -1
@@ -2347,7 +2347,7 @@ snd_azf3328_create(struct snd_card *card,return -ENXIO ; } - err =pci_request_regions (pci,"Aztech AZF3328" ); + err =pcim_request_all_regions (pci,"Aztech AZF3328" );if (err <0 )return err;
Signature · 1 line
2.48.1
PATCH 15/31 ALSA: als: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/als300.c | 2 +- sound/pci/als4000.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/als300.c +1 -1
@@ -617,7 +617,7 @@ static int snd_als300_create(struct snd_card *card, chip->chip_type = chip_type;spin_lock_init (&chip->reg_lock); - err =pci_request_regions (pci,"ALS300" ); + err =pcim_request_all_regions (pci,"ALS300" );if (err <0 )return err;
sound/pci/als4000.c +1 -1
@@ -836,7 +836,7 @@ static int __snd_card_als4000_probe(struct pci_dev *pci,return -ENXIO ; } - err =pci_request_regions (pci,"ALS4000" ); + err =pcim_request_all_regions (pci,"ALS4000" );if (err <0 )return err; iobase =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 16/31 ALSA: oxygen: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/oxygen/oxygen_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/oxygen/oxygen_lib.c +1 -1
@@ -609,7 +609,7 @@ static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id,if (err <0 )return err; - err =pci_request_regions (pci,DRIVER ); + err =pcim_request_all_regions (pci,DRIVER );if (err <0 ) {dev_err (card->dev,"cannot reserve PCI resources\n" );return err;
Signature · 1 line
2.48.1
PATCH 17/31 ALSA: lx6464es: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/lx6464es/lx6464es.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/lx6464es/lx6464es.c +1 -1
@@ -944,7 +944,7 @@ static int snd_lx6464es_create(struct snd_card *card,mutex_init (&chip->setup_mutex);/* request resources */ - err =pci_request_regions (pci, card_name); + err =pcim_request_all_regions (pci, card_name);if (err <0 )return err;
Signature · 1 line
2.48.1
PATCH 18/31 ALSA: vx222: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
Pass the driver's name as the name parameter ofpcim_request_all_regions().
--- sound/pci/vx222/vx222.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/vx222/vx222.c +1 -1
@@ -123,7 +123,7 @@ static int snd_vx222_create(struct snd_card *card, struct pci_dev *pci, vx =to_vx222 (chip); vx->pci = pci; - err =pci_request_regions (pci,CARD_NAME ); + err =pcim_request_all_regions (pci,KBUILD_MODNAME );if (err <0 )return err;for (i =0 ; i <2 ; i++)
Signature · 1 line
2.48.1
PATCH 19/31 ALSA: trident: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
In addition, the request function's name parameter should describe the driver, not the device.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/trident/trident_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/trident/trident_main.c +1 -1
@@ -3533,7 +3533,7 @@ int snd_trident_create(struct snd_card *card, trident->midi_port =TRID_REG (trident,T4D_MPU401_BASE );pci_set_master (pci); - err =pci_request_regions (pci,"Trident Audio" ); + err =pcim_request_all_regions (pci,"Trident Audio" );if (err <0 )return err; trident->port =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 20/31 ALSA: rme9652: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/rme9652/hdsp.c | 2 +- sound/pci/rme9652/rme9652.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/rme9652/hdsp.c +1 -1
@@ -5277,7 +5277,7 @@ static int snd_hdsp_create(struct snd_card *card,pci_set_master (hdsp->pci); - err =pci_request_regions (pci,"hdsp" ); + err =pcim_request_all_regions (pci,"hdsp" );if (err <0 )return err; hdsp->port =pci_resource_start (pci,0 );
sound/pci/rme9652/rme9652.c +1 -1
@@ -2406,7 +2406,7 @@ static int snd_rme9652_create(struct snd_card *card,spin_lock_init (&rme9652->lock); - err =pci_request_regions (pci,"rme9652" ); + err =pcim_request_all_regions (pci,"rme9652" );if (err <0 )return err; rme9652->port =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 21/31 ALSA: ymfpci: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/ymfpci/ymfpci_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/ymfpci/ymfpci_main.c +1 -1
@@ -2307,7 +2307,7 @@ int snd_ymfpci_create(struct snd_card *card, chip->device_id = pci->device; chip->rev = pci->revision; - err =pci_request_regions (pci,"YMFPCI" ); + err =pcim_request_all_regions (pci,"YMFPCI" );if (err <0 )return err;
Signature · 1 line
2.48.1
PATCH 22/31 ALSA: riptide: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/riptide/riptide.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/riptide/riptide.c +1 -1
@@ -1831,7 +1831,7 @@ snd_riptide_create(struct snd_card *card, struct pci_dev *pci) chip->cif =NULL ; card->private_free = snd_riptide_free; - err =pci_request_regions (pci,"RIPTIDE" ); + err =pcim_request_all_regions (pci,"RIPTIDE" );if (err <0 )return err; hwport = (struct riptideport *)chip->port;
Signature · 1 line
2.48.1
PATCH 23/31 ALSA: nm256: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/nm256/nm256.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/nm256/nm256.c +1 -1
@@ -1447,7 +1447,7 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci) chip->buffer_addr =pci_resource_start (pci,0 ); chip->cport_addr =pci_resource_start (pci,1 ); - err =pci_request_regions (pci, card->driver); + err =pcim_request_all_regions (pci, card->driver);if (err <0 )return err;
Signature · 1 line
2.48.1
PATCH 24/31 ALSA: ice: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/ice1712/ice1712.c | 2 +- sound/pci/ice1712/ice1724.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/ice1712/ice1712.c +1 -1
@@ -2502,7 +2502,7 @@ static int snd_ice1712_create(struct snd_card *card,pci_write_config_word (ice->pci,0x42 ,0x0006 );snd_ice1712_proc_init (ice); - err =pci_request_regions (pci,"ICE1712" ); + err =pcim_request_all_regions (pci,"ICE1712" );if (err <0 )return err; ice->port =pci_resource_start (pci,0 );
sound/pci/ice1712/ice1724.c +1 -1
@@ -2491,7 +2491,7 @@ static int snd_vt1724_create(struct snd_card *card,pci_set_master (pci);snd_vt1724_proc_init (ice); - err =pci_request_regions (pci,"ICE1724" ); + err =pcim_request_all_regions (pci,"ICE1724" );if (err <0 )return err; ice->port =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 25/31 ALSA: emu10k1: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/emu10k1/emu10k1_main.c | 2 +- sound/pci/emu10k1/emu10k1x.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/emu10k1/emu10k1_main.c +1 -1
@@ -1563,7 +1563,7 @@ int snd_emu10k1_create(struct snd_card *card,else emu->gpr_base =FXGPREGBASE ; - err =pci_request_regions (pci,"EMU10K1" ); + err =pcim_request_all_regions (pci,"EMU10K1" );if (err <0 )return err; emu->port =pci_resource_start (pci,0 );
sound/pci/emu10k1/emu10k1x.c +1 -1
@@ -884,7 +884,7 @@ static int snd_emu10k1x_create(struct snd_card *card,spin_lock_init (&chip->emu_lock);spin_lock_init (&chip->voice_lock); - err =pci_request_regions (pci,"EMU10K1X" ); + err =pcim_request_all_regions (pci,"EMU10K1X" );if (err <0 )return err; chip->port =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 26/31 ALSA: echoaudio: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/echoaudio/echoaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/echoaudio/echoaudio.c +1 -1
@@ -1910,7 +1910,7 @@ static int snd_echo_create(struct snd_card *card, chip->can_set_rate =1 ;/* PCI resource allocation */ - err =pci_request_regions (pci,ECHOCARD_NAME ); + err =pcim_request_all_regions (pci,ECHOCARD_NAME );if (err <0 )return err;
Signature · 1 line
2.48.1
PATCH 27/31 ALSA: cs5535: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/cs5535audio/cs5535audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/cs5535audio/cs5535audio.c +1 -1
@@ -262,7 +262,7 @@ static int snd_cs5535audio_create(struct snd_card *card, cs5535au->pci = pci; cs5535au->irq =-1 ; - err =pci_request_regions (pci,"CS5535 Audio" ); + err =pcim_request_all_regions (pci,"CS5535 Audio" );if (err <0 )return err;
Signature · 1 line
2.48.1
PATCH 28/31 ALSA: cs46xx: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/cs46xx/cs46xx_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/cs46xx/cs46xx_lib.c +1 -1
@@ -3839,7 +3839,7 @@ int snd_cs46xx_create(struct snd_card *card, chip->pci = pci; chip->irq =-1 ; - err =pci_request_regions (pci,"CS46xx" ); + err =pcim_request_all_regions (pci,"CS46xx" );if (err <0 )return err; chip->ba0_addr =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 29/31 ALSA: ca0106: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/ca0106/ca0106_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/ca0106/ca0106_main.c +1 -1
@@ -1593,7 +1593,7 @@ static int snd_ca0106_create(int dev, struct snd_card *card,spin_lock_init (&chip->emu_lock); - err =pci_request_regions (pci,"snd_ca0106" ); + err =pcim_request_all_regions (pci,"snd_ca0106" );if (err <0 )return err; chip->port =pci_resource_start (pci,0 );
Signature · 1 line
2.48.1
PATCH 30/31 ALSA: ali5451: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/ali5451/ali5451.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/ali5451/ali5451.c +1 -1
@@ -1989,7 +1989,7 @@ static int snd_ali_resources(struct snd_ali *codec)int err;dev_dbg (codec->card->dev,"resources allocation ...\n" ); - err =pci_request_regions (codec->pci,"ALI 5451" ); + err =pcim_request_all_regions (codec->pci,"ALI 5451" );if (err <0 )return err; codec->port =pci_resource_start (codec->pci,0 );
Signature · 1 line
2.48.1
PATCH 31/31 ALSA: maestro3: Use pure devres PCI
In reply to Philipp Stannerpci_request_regions() is a hybrid function which becomes managed if pcim_enable_device() was called before. This hybrid nature is deprecated and should not be used anymore.
Replace pci_request_regions() with the always-managed function pcim_request_all_regions().
--- sound/pci/maestro3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/maestro3.c +1 -1
@@ -2552,7 +2552,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,if (err <0 )return err; - err =pci_request_regions (pci, card->driver); + err =pcim_request_all_regions (pci, card->driver);if (err <0 )return err;
Signature · 1 line
2.48.1
Quoted 7 lines · Philipp Stanner
Hi,
a year ago we spent quite some work trying to get PCI into better shape. Some
pci_functions can be sometimes managed with devres, which is obviously bad. We want to provide an obvious API, wherepci_functions are never, andpcim_functions are always managed.
Quoted 6 lines
Thus, everyone enabling his device with
pcim_enable_device()must be ported topcim_functions. Porting all users will later enable us to significantly simplify parts of the PCI subsystem. See here [1] for details.This patch series does that for sound.
AFAIK the ASoC and ALSA maintained by different people and perhaps you would need to split, but I'm not the guy in charge, so wait for them to tell you their preferences.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 01/31] ASoC: sof: Use pure devres PCI
In reply to Philipp StannerQuoted 9 lines · Philipp Stanner
pci_request_regions()is a hybrid function which becomes managed ifpcim_enable_device()was called before. This hybrid nature is deprecated and should not be used anymore.Replace
pci_request_regions()with the always-managed functionpcim_request_all_regions().Remove surplus calls to PCI release functions, since
pcim_functions do cleanup automatically.
...
sound/soc/sof/sof-pci-dev.c int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) · line 275
Quoted 7 lines
sound/soc/sof/sof-pci-dev.c +0
-4ret =snd_sof_device_probe (dev, sof_pdata); -out: -if (ret) -pci_release_regions (pci); -return ret;
Obviously you can go further
return snd_sof_...(...);
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 02/31] ASoC: intel/avs: Use pure devres PCI
In reply to Philipp StannerQuoted 9 lines · Philipp Stanner
pci_request_regions()is a hybrid function which becomes managed ifpcim_enable_device()was called before. This hybrid nature is deprecated and should not be used anymore.Replace
pci_request_regions()with the always-managed functionpcim_request_all_regions().Remove the goto jump to
pci_release_regions(), sincepcim_functions clean up automatically.
...
sound/soc/intel/avs/core.c static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) · line 457
Quoted 6 lines
sound/soc/intel/avs/core.c +1
-2bus->remap_addr =pci_ioremap_bar (pci,0 );if (!bus->remap_addr) {dev_err (bus->dev,"ioremap error\n" ); - ret = -ENXIO ; - goto err_remap_bar0; +return -ENXIO ;
Here and everywhere else these can now be converted to dev_err_probe(). Are you planning to do so?
...
Quoted 2 lines
err_remap_bar4:
iounmap(bus->remap_addr);
This looks weird if the driver already is using pcim_enable_device(). Doesn't this look to you as an existing bug?
Quoted 3 lines
sound/soc/intel/avs/core.c +0
-2-err_remap_bar0: -pci_release_regions (pci);return ret;
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 03/31] AsoC: intel/atom: Use pure devres PCI
In reply to Philipp StannerQuoted 12 lines · Philipp Stanner
pci_request_regions()is a hybrid function which becomes managed ifpcim_enable_device()was called before. This hybrid nature is deprecated and should not be used anymore.Replace
pci_request_regions()with the always-managed functionpcim_request_all_regions().Remove the call to
pci_release_regions(), sincepcim_functions do cleanup automatically.Pass 0 as length parameter to
pcim_iomap(), which is the standard way for ioremapping an entire BAR.
...
Quoted 2 lines
sound/soc/intel/atom/sst/sst_pci.c | 56 ++++++++++++------------------ 1 file changed, 23 insertions(+), 33 deletions(-)
Cool cleanup!
...
sound/soc/intel/atom/sst/sst_pci.c static int sst_platform_get_resources(struct intel_sst_drv *ctx) · line 88
Quoted 6 lines
sound/soc/intel/atom/sst/sst_pci.c +3
-0/* DRAM */ ctx->dram_end =pci_resource_end (pci,4 ); ctx->dram_base =pci_resource_start (pci,4 ); + ctx->dram =pcim_iomap (pci,4 ,0 ); +if (!ctx->dram) +return -EINVAL ;
Why EINVAL and not ENOMEM? mapping is about memory, no?
sound/soc/intel/atom/sst/sst_pci.c static int sst_platform_get_resources(struct intel_sst_drv *ctx) · line 91
Quoted 5 lines
sound/soc/intel/atom/sst/sst_pci.c +1
-2+dev_dbg (ctx->dev,"DRAM Ptr %p\n" , ctx->dram); -do_release_regions: -pci_release_regions (pci);return ret;
Now it seems
return 0;
should suffice here.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Andy Shevchenko
Reviewed-byQuoted 12 lines · Andy Shevchenko
Quoted 10 lines · Philipp Stanner
a year ago we spent quite some work trying to get PCI into better shape. Some
pci_functions can be sometimes managed with devres, which is obviously bad. We want to provide an obvious API, wherepci_functions are never, andpcim_functions are always managed.Thus, everyone enabling his device with
pcim_enable_device()must be ported topcim_functions. Porting all users will later enable us to significantly simplify parts of the PCI subsystem. See here [1] for details.
Quoted 5 lines
Quoted 1 line
This patch series does that for sound.
AFAIK the ASoC and ALSA maintained by different people and perhaps you would need to split, but I'm not the guy in charge, so wait for them to tell you their preferences.
Seems split is a good to have as I just looked to all of them and ALSA are pretty straightforward, while for every patch in ASoC I have a comment.
So, here is a formal tag for all ALSA patches. Feel free to send a v2 with them and the tag.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 02/31] ASoC: intel/avs: Use pure devres PCI
In reply to Andy Shevchenko+Cc Bjorn, Krzysztof
Quoted 15 lines · Andy Shevchenko
Quoted 11 lines · Philipp Stanner
pci_request_regions()is a hybrid function which becomes managed ifpcim_enable_device()was called before. This hybrid nature is deprecated
and should not be used anymore.Replace
pci_request_regions()with the always-managed functionpcim_request_all_regions().Remove the goto jump to
pci_release_regions(), sincepcim_functions
clean up automatically....
Quoted 10 lines
sound/soc/intel/avs/core.c static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) · line 457
Quoted 6 lines
bus->remap_addr=pci_ioremap_bar(pci, 0); if (!bus->remap_addr) {dev_err(bus->dev, "ioremap error\n");sound/soc/intel/avs/core.c +1
-2- ret = -ENXIO ; - goto err_remap_bar0; +return -ENXIO ;Here and everywhere else these can now be converted to
dev_err_probe().
Are you planning to do so?
I want to do what's necessary to get PCI in better shape, since that's what the GPUs and accelerators we / I care about use :)
IOW, I want pci_request_regions() removed from here.
Quoted 8 lines
...
Quoted 2 lines
err_remap_bar4:
iounmap(bus->remap_addr);This looks weird if the driver already is using
pcim_enable_device(). Doesn't this look to you as an existing bug?
I looked briefly at it and it doesn't appear like an obvious bug to me because the drivers uses the (very old? deprecated?) pci_ioremap_bar().
In any case the driver doesn't set up any devres callback, so has to iounmap() manually.
@Bjorn:
Any comments on pci_ioremap_bar()? Should we mark that as deprecated?
P.
Quoted 5 lines
Quoted 4 lines
sound/soc/intel/avs/core.c +0
-2-err_remap_bar0: -pci_release_regions (pci);return ret;
Re: [PATCH 02/31] ASoC: intel/avs: Use pure devres PCI
Quoted 2 lines · Philipp Stanner
Quoted 1 line · Andy Shevchenko
On Wed, Apr 16, 2025 at 03:12:12PM +0200, Philipp Stanner wrote:
...
Quoted 11 lines
Quoted 10 lines
sound/soc/intel/avs/core.c static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) · line 457
Quoted 6 lines
bus->remap_addr=pci_ioremap_bar(pci, 0); if (!bus->remap_addr) {dev_err(bus->dev, "ioremap error\n");sound/soc/intel/avs/core.c +1
-2- ret = -ENXIO ; - goto err_remap_bar0; +return -ENXIO ;Here and everywhere else these can now be converted to
dev_err_probe().
Are you planning to do so?
Quoted 4 lines
I want to do what's necessary to get PCI in better shape, since that's what the GPUs and accelerators we / I care about use :)
IOW, I want
pci_request_regions()removed from here.
Okay!
...
Quoted 11 lines
Quoted 5 lines
Quoted 2 lines
err_remap_bar4:
iounmap(bus->remap_addr);This looks weird if the driver already is using
pcim_enable_device(). Doesn't this look to you as an existing bug?I looked briefly at it and it doesn't appear like an obvious bug to me because the drivers uses the (very old? deprecated?)
pci_ioremap_bar().In any case the driver doesn't set up any devres callback, so has to
iounmap()manually.
Okay, so they are using managed and non-managed APIs, but release / error path ordering is fine. So, false alarm then.
Quoted 6 lines
@Bjorn:
Any comments onpci_ioremap_bar()? Should we mark that as deprecated?Quoted 3 lines
Quoted 3 lines
sound/soc/intel/avs/core.c +0
-2-err_remap_bar0: -pci_release_regions (pci);return ret;
Signature · 2 lines
With Best Regards, Andy Shevchenko