Remove pcim_iomap_regions_request_all()
Subsystems (14)
v2 cover Remove pcim_iomap_regions_request_all()
Changes in v2:
- Fix a bug in patch №4 ("crypto: marvell ...") where an error code was not set before printing it. (Me)
- Apply Damien's Reviewed- / Acked-by to patches 1, 2 and 10. (Damien)
- Apply Serge's Acked-by to patch №7. (Serge)
- Apply Jiri's Reviewed-by to patch №8. (Jiri)
- Apply Takashi Iwai's Reviewed-by to patch №9. (Takashi)
Hi all,
the PCI subsystem is currently working on cleaning up its devres API. To do so, a few functions will be replaced with better alternatives.
This series removes pcim_iomap_regions_request_all(), which has been deprecated already, and accordingly replaces the calls to pcim_iomap_table() (which were only necessary because of pcim_iomap_regions_request_all() in the first place) with calls to pcim_iomap().
Would be great if you can take a look whether this behaves as you intended for your respective component.
Cheers,
Philipp
Philipp Stanner (10):
PCI: Make pcim_request_all_regions() a public function
ata: ahci: Replace deprecated PCI functions
crypto: qat - replace deprecated PCI functions
crypto: marvell - replace deprecated PCI functions
intel_th: pci: Replace deprecated PCI functions
wifi: iwlwifi: replace deprecated PCI functions
ntb: idt: Replace deprecated PCI functions
serial: rp2: Replace deprecated PCI functions
ALSA: korg1212: Replace deprecated PCI functions
PCI: Remove pcim_iomap_regions_request_all()
.../driver-api/driver-model/devres.rst | 1 - drivers/ata/acard-ahci.c | 6 +- drivers/ata/ahci.c | 6 +- drivers/crypto/intel/qat/qat_420xx/adf_drv.c | 11 +++- drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 11 +++- .../marvell/octeontx2/otx2_cptpf_main.c | 14 +++-- .../marvell/octeontx2/otx2_cptvf_main.c | 13 ++-- drivers/hwtracing/intel_th/pci.c | 9 ++- .../net/wireless/intel/iwlwifi/pcie/trans.c | 16 ++--- drivers/ntb/hw/idt/ntb_hw_idt.c | 13 ++-- drivers/pci/devres.c | 59 +------------------ drivers/tty/serial/rp2.c | 12 ++-- include/linux/pci.h | 3 +- sound/pci/korg1212/korg1212.c | 6 +- 14 files changed, 76 insertions(+), 104 deletions(-)
Signature · 1 line
2.45.2
PATCH v2 1/10 PCI: Make pcim_request_all_regions() a public function
In order to remove the deprecated function pcim_iomap_regions_request_all(), a few drivers need an interface to request all BARs a PCI-Device offers.
Make pcim_request_all_regions() a public interface.
--- drivers/pci/devres.c | 3 ++- include/linux/pci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/pci/devres.c +2 -1
@@ -932,7 +932,7 @@ static void pcim_release_all_regions(struct pci_dev *pdev)* desired, release individual regions with pcim_release_region() or all of * them at once with pcim_release_all_regions(). */ -static int pcim_request_all_regions (struct pci_dev *pdev,const char *name) +int pcim_request_all_regions (struct pci_dev *pdev,const char *name) {int ret;int bar;
@@ -950,6 +950,7 @@ static int pcim_request_all_regions(struct pci_dev *pdev, const char *name)return ret; } +EXPORT_SYMBOL (pcim_request_all_regions);/** * pcim_iomap_regions_request_all - Request all BARs and iomap specified ones
include/linux/pci.h +1 -0
@@ -2289,6 +2289,7 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) { }#endif +int pcim_request_all_regions (struct pci_dev *pdev,const char *name);void __iomem *pcim_iomap (struct pci_dev *pdev,int bar,unsigned long maxlen);void pcim_iounmap (struct pci_dev *pdev,void __iomem *addr);void __iomem *const *pcim_iomap_table (struct pci_dev *pdev);
Signature · 1 line
2.45.2
PATCH v2 2/10 ata: ahci: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_regions_request_all() and pcim_iomap_table() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with their successors, pcim_iomap() and pcim_request_all_regions()
--- drivers/ata/acard-ahci.c | 6 ++++-- drivers/ata/ahci.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/ata/acard-ahci.c +4 -2
@@ -370,7 +370,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id/* AHCI controllers often implement SFF compatible interface. * Grab all PCI BARs just in case. */ - rc =pcim_iomap_regions_request_all (pdev,1 <<AHCI_PCI_BAR ,DRV_NAME ); + rc =pcim_request_all_regions (pdev,DRV_NAME );if (rc == -EBUSY )pcim_pin_device (pdev);if (rc)
@@ -386,7 +386,9 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_idif (!(hpriv->flags &AHCI_HFLAG_NO_MSI ))pci_enable_msi (pdev); - hpriv->mmio =pcim_iomap_table (pdev)[AHCI_PCI_BAR ]; + hpriv->mmio =pcim_iomap (pdev,AHCI_PCI_BAR ,0 ); +if (!hpriv->mmio) +return -ENOMEM ;/* save initial config */ ahci_save_initial_config (&pdev->dev, hpriv);
drivers/ata/ahci.c +4 -2
@@ -1869,7 +1869,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)/* AHCI controllers often implement SFF compatible interface. * Grab all PCI BARs just in case. */ - rc =pcim_iomap_regions_request_all (pdev,1 << ahci_pci_bar,DRV_NAME ); + rc =pcim_request_all_regions (pdev,DRV_NAME );if (rc == -EBUSY )pcim_pin_device (pdev);if (rc)
@@ -1893,7 +1893,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)if (ahci_sb600_enable_64bit (pdev)) hpriv->flags &= ~AHCI_HFLAG_32BIT_ONLY ; - hpriv->mmio =pcim_iomap_table (pdev)[ahci_pci_bar]; + hpriv->mmio =pcim_iomap (pdev, ahci_pci_bar,0 ); +if (!hpriv->mmio) +return -ENOMEM ;/* detect remapped nvme devices */ ahci_remap_check (pdev, ahci_pci_bar, hpriv);
Signature · 1 line
2.45.2
PATCH v2 3/10 crypto: qat - replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions_request_all() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with their successors, pcim_iomap() and pcim_request_all_regions()
--- drivers/crypto/intel/qat/qat_420xx/adf_drv.c | 11 ++++++++--- drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-)
drivers/crypto/intel/qat/qat_420xx/adf_drv.c +8 -3
@@ -129,16 +129,21 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* Find and map all the device's BARS */ bar_mask =pci_select_bars (pdev,IORESOURCE_MEM ) &ADF_GEN4_BAR_MASK ; - ret =pcim_iomap_regions_request_all (pdev, bar_mask,pci_name (pdev)); + ret =pcim_request_all_regions (pdev,pci_name (pdev));if (ret) { -dev_err (&pdev->dev,"Failed to map pci regions.\n" ); +dev_err (&pdev->dev,"Failed to request PCI regions.\n" ); goto out_err; } i =0 ;for_each_set_bit (bar_nr, &bar_mask,PCI_STD_NUM_BARS ) { bar = &accel_pci_dev->pci_bars[i++]; - bar->virt_addr =pcim_iomap_table (pdev)[bar_nr]; + bar->virt_addr =pcim_iomap (pdev, bar_nr,0 ); +if (!bar->virt_addr) { +dev_err (&pdev->dev,"Failed to ioremap PCI region.\n" ); + ret = -ENOMEM ; + goto out_err; + } }pci_set_master (pdev);
drivers/crypto/intel/qat/qat_4xxx/adf_drv.c +8 -3
@@ -131,16 +131,21 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* Find and map all the device's BARS */ bar_mask =pci_select_bars (pdev,IORESOURCE_MEM ) &ADF_GEN4_BAR_MASK ; - ret =pcim_iomap_regions_request_all (pdev, bar_mask,pci_name (pdev)); + ret =pcim_request_all_regions (pdev,pci_name (pdev));if (ret) { -dev_err (&pdev->dev,"Failed to map pci regions.\n" ); +dev_err (&pdev->dev,"Failed to request PCI regions.\n" ); goto out_err; } i =0 ;for_each_set_bit (bar_nr, &bar_mask,PCI_STD_NUM_BARS ) { bar = &accel_pci_dev->pci_bars[i++]; - bar->virt_addr =pcim_iomap_table (pdev)[bar_nr]; + bar->virt_addr =pcim_iomap (pdev, bar_nr,0 ); +if (!bar->virt_addr) { +dev_err (&pdev->dev,"Failed to ioremap PCI region.\n" ); + ret = -ENOMEM ; + goto out_err; + } }pci_set_master (pdev);
Signature · 1 line
2.45.2
PATCH v2 4/10 crypto: marvell - replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions_request_all() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with their successors, pcim_iomap() and pcim_request_all_regions()
--- drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 14 +++++++++----- drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c | 13 +++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +9 -5
@@ -739,18 +739,22 @@ static int otx2_cptpf_probe(struct pci_dev *pdev,dev_err (dev,"Unable to get usable DMA configuration\n" ); goto clear_drvdata; } -/* Map PF's configuration registers */ - err =pcim_iomap_regions_request_all (pdev,1 <<PCI_PF_REG_BAR_NUM , -OTX2_CPT_DRV_NAME ); + err =pcim_request_all_regions (pdev,OTX2_CPT_DRV_NAME );if (err) { -dev_err (dev,"Couldn't get PCI resources 0x%x\n" , err); +dev_err (dev,"Couldn't request PCI resources 0x%x\n" , err); goto clear_drvdata; }pci_set_master (pdev);pci_set_drvdata (pdev, cptpf); cptpf->pdev = pdev; - cptpf->reg_base =pcim_iomap_table (pdev)[PCI_PF_REG_BAR_NUM ]; +/* Map PF's configuration registers */ + cptpf->reg_base =pcim_iomap (pdev,PCI_PF_REG_BAR_NUM ,0 ); +if (!cptpf->reg_base) { + err = -ENOMEM ; +dev_err (dev,"Couldn't ioremap PCI resource 0x%x\n" , err); + goto clear_drvdata; + }/* Check if AF driver is up, otherwise defer probe */ err =cpt_is_pf_usable (cptpf);
drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c +9 -4
@@ -358,9 +358,8 @@ static int otx2_cptvf_probe(struct pci_dev *pdev,dev_err (dev,"Unable to get usable DMA configuration\n" ); goto clear_drvdata; } -/* Map VF's configuration registers */ - ret =pcim_iomap_regions_request_all (pdev,1 <<PCI_PF_REG_BAR_NUM , -OTX2_CPTVF_DRV_NAME ); + + ret =pcim_request_all_regions (pdev,OTX2_CPTVF_DRV_NAME );if (ret) {dev_err (dev,"Couldn't get PCI resources 0x%x\n" , ret); goto clear_drvdata;
@@ -369,7 +368,13 @@ static int otx2_cptvf_probe(struct pci_dev *pdev,pci_set_drvdata (pdev, cptvf); cptvf->pdev = pdev; - cptvf->reg_base =pcim_iomap_table (pdev)[PCI_PF_REG_BAR_NUM ]; +/* Map VF's configuration registers */ + cptvf->reg_base =pcim_iomap (pdev,PCI_PF_REG_BAR_NUM ,0 ); +if (!cptvf->reg_base) { + ret = -ENOMEM ; +dev_err (dev,"Couldn't ioremap PCI resource 0x%x\n" , ret); + goto clear_drvdata; + }otx2_cpt_set_hw_caps (pdev, &cptvf->cap_flag);
Signature · 1 line
2.45.2
Re: [PATCH v2 04/10] crypto: marvell - replace deprecated PCI functions
(Reduced Cc list a lot)
Quoted 6 lines · Philipp Stanner
pcim_iomap_table()andpcim_iomap_regions_request_all()have been deprecated by the PCI subsystem in commite354bb84a4c1("PCI: Deprecatepcim_iomap_table(),pcim_iomap_regions_request_all()").Replace these functions with their successors,
pcim_iomap()andpcim_request_all_regions()
Missing period at the end.
...
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c static int otx2_cptpf_probe(struct pci_dev *pdev, · line 746
Quoted 9 lines
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +2
-4-/* Map PF's configuration registers */ - err =pcim_iomap_regions_request_all (pdev,1 <<PCI_PF_REG_BAR_NUM , -OTX2_CPT_DRV_NAME ); + err =pcim_request_all_regions (pdev,OTX2_CPT_DRV_NAME );if (err) { -dev_err (dev,"Couldn't get PCI resources 0x%x\n" , err); +dev_err (dev,"Couldn't request PCI resources 0x%x\n" , err); goto clear_drvdata; }
I haven't looked at the implementation differences of those two, but would it be really an equivalent change now?
Note, the resource may be requested, OR mapped, OR both. In accordance with the naming above I assume that this is not equivalent change with potential breakages.
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c static int otx2_cptpf_probe(struct pci_dev *pdev, · line 757
Quoted 8 lines
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +7
-1- cptpf->reg_base =pcim_iomap_table (pdev)[PCI_PF_REG_BAR_NUM ]; +/* Map PF's configuration registers */ + cptpf->reg_base =pcim_iomap (pdev,PCI_PF_REG_BAR_NUM ,0 ); +if (!cptpf->reg_base) { + err = -ENOMEM ; +dev_err (dev,"Couldn't ioremap PCI resource 0x%x\n" , err); + goto clear_drvdata; + }
(Yes, I see this).
...
drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c
Quoted 2 lines
drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c +0
-0
Ditto. here.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 04/10] crypto: marvell - replace deprecated PCI functions
Yo Andy!
Quoted 8 lines · Andy Shevchenko
(Reduced Cc list a lot)
Quoted 5 lines · Philipp Stanner
pcim_iomap_table()andpcim_iomap_regions_request_all()have been deprecated by the PCI subsystem in commite354bb84a4c1("PCI:
Deprecatepcim_iomap_table(),pcim_iomap_regions_request_all()").
Quoted 4 lines
Quoted 2 lines
Replace these functions with their successors,
pcim_iomap()andpcim_request_all_regions()Missing period at the end.
ACK
Quoted 14 lines
...
Quoted 10 lines
- /* Map PF's configuration registers */
- err = pcim_iomap_regions_request_all(pdev, 1 <<PCI_PF_REG_BAR_NUM,
-OTX2_CPT_DRV_NAME);
+ err =pcim_request_all_regions(pdev, OTX2_CPT_DRV_NAME); if (err) {
-dev_err(dev, "Couldn't get PCI resources 0x%x\n", err);
+dev_err(dev, "Couldn't request PCI resources 0x%x\n", err); gotoclear_drvdata;
}
Quoted 3 lines
I haven't looked at the implementation differences of those two, but would it
be really an equivalent change now?
Well, if I weren't convinced that it's 100% equivalent I weren't posting it :)
pcim_iomap_regions_request_all() already usespcim_request_all_regions() internally.
The lines you quote here are not equivalent to the old version, but in combination with the following lines the functionality is identical:
1. Request all regions
2. ioremap BAR OTX2_CPT_BAR_NUM
Quoted 2 lines
Note, the resource may be requested, OR mapped, OR both.
Negative, that is not how pcim_iomap_regions_request_all() works. That overengineered function requests *all* PCI BARs and ioremap()s those specified in the bit mask.
If you don't set a bit, you'll request all regions and ioremap() none. However you choose to use it, it will always request all regions and map between 0 and PCI_STD_NUM_BARS.
Quoted 4 lines
In accordance with the
naming above I assume that this is not equivalent change with potential
breakages.
The nasty thing of us in PCI is that you more or less already use the code above anyways, because in v6.11 I reworked most of drivers/pci/devres.c, so pcim_iomap_regions_request_all() uses both pcim_request_all_regions() and pcim_iomap() in precisely that order already.
The only hypothetical breakages which are not already in v6.11 anyways I could imagine are:
* Someone complaining about changed error codes in case of failure
* Someone racing between the calls to pcim_request_all_regions() and pcim_iomap(). But that's why the region request is actually there in the first place, to block off drivers competing for the same resource. And AFAIU probe() functions don't race anyways.
Anything I might have overlooked?
P.
Quoted 20 lines
Quoted 10 lines
-
cptpf->reg_base= pcim_iomap_table(pdev)[PCI_PF_REG_BAR_NUM];
+ /* Map PF's configuration registers */
+cptpf->reg_base=pcim_iomap(pdev, PCI_PF_REG_BAR_NUM, 0);
+ if (!cptpf->reg_base) {
+ err =-ENOMEM;
+dev_err(dev, "Couldn't ioremap PCI resource 0x%x\n", err);
+ gotoclear_drvdata;
+ }(Yes, I see this).
...
drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c
Quoted 2 lines
drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c +0
-0Ditto. here.
Re: [PATCH v2 04/10] crypto: marvell - replace deprecated PCI functions
Quoted 2 lines · Philipp Stanner
Quoted 1 line · Andy Shevchenko
On Mon, Aug 05, 2024 at 10:01:31AM +0200, Philipp Stanner wrote:
...
Quoted 27 lines
Quoted 11 lines
Quoted 10 lines
- /* Map PF's configuration registers */
- err = pcim_iomap_regions_request_all(pdev, 1 <<PCI_PF_REG_BAR_NUM,
-OTX2_CPT_DRV_NAME);
+ err =pcim_request_all_regions(pdev, OTX2_CPT_DRV_NAME); if (err) {
-dev_err(dev, "Couldn't get PCI resources 0x%x\n", err);
+dev_err(dev, "Couldn't request PCI resources 0x%x\n", err); gotoclear_drvdata;
}Quoted 3 lines
I haven't looked at the implementation differences of those two, but would it
be really an equivalent change now?Well, if I weren't convinced that it's 100% equivalent I weren't posting it :)
pcim_iomap_regions_request_all()already usespcim_request_all_regions()internally.The lines you quote here are not equivalent to the old version, but in combination with the following lines the functionality is identical:
1. Request all regions
2. ioremap BAROTX2_CPT_BAR_NUMQuoted 1 line
Quoted 3 lines
Quoted 1 line
Note, the resource may be requested, OR mapped, OR both.
Negative, that is not how
pcim_iomap_regions_request_all()works.
(I was talking from the generic resource management in the kernel perspective)
Quoted 7 lines
That
overengineered function requests *all* PCI BARs and ioremap()s those specified in the bit mask.If you don't set a bit, you'll request all regions and
ioremap()none. However you choose to use it, it will always request all regions and map between 0 andPCI_STD_NUM_BARS.
Oh, thanks to you we are getting rid of this awfully interfaced API!
Quoted 19 lines
Quoted 4 lines
In accordance with the
naming above I assume that this is not equivalent change with potential
breakages.The nasty thing of us in PCI is that you more or less already use the code above anyways, because in v6.11 I reworked most of
drivers/pci/devres.c, sopcim_iomap_regions_request_all()uses bothpcim_request_all_regions()andpcim_iomap()in precisely that order already.The only hypothetical breakages which are not already in v6.11 anyways I could imagine are:
* Someone complaining about changed error codes in case of failure
* Someone racing between the calls topcim_request_all_regions()andpcim_iomap(). But that's why the region request is actually there in the first place, to block off drivers competing for the same resource. And AFAIUprobe()functions don't race anyways.
Quoted 1 line
Anything I might have overlooked?
Dunno, but the above sounds like a good explanation.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 5/10 intel_th: pci: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions_request_all() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with their successors, pcim_iomap() and pcim_request_all_regions()
--- drivers/hwtracing/intel_th/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/hwtracing/intel_th/pci.c +7 -2
@@ -23,7 +23,6 @@ enum { TH_PCI_RTIT_BAR = 4, }; -#define BAR_MASK (BIT(TH_PCI_CONFIG_BAR) | BIT(TH_PCI_STH_SW_BAR))#define PCI_REG_NPKDSC 0x80#define NPKDSC_TSACT BIT(5)
@@ -83,10 +82,16 @@ static int intel_th_pci_probe(struct pci_dev *pdev,if (err)return err; - err =pcim_iomap_regions_request_all (pdev,BAR_MASK ,DRIVER_NAME ); + err =pcim_request_all_regions (pdev,DRIVER_NAME );if (err)return err; +if (!pcim_iomap (pdev,TH_PCI_CONFIG_BAR ,0 )) +return -ENOMEM ; + +if (!pcim_iomap (pdev,TH_PCI_STH_SW_BAR ,0 )) +return -ENOMEM ; +if (pdev->resource[TH_PCI_RTIT_BAR ].start) { resource[TH_MMIO_RTIT ] = pdev->resource[TH_PCI_RTIT_BAR ]; r++;
Signature · 1 line
2.45.2
PATCH v2 6/10 wifi: iwlwifi: replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions_request_all() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with their successors, pcim_iomap() and pcim_request_all_regions()
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +4 -12
@@ -3534,7 +3534,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,struct iwl_trans_pcie *trans_pcie, **priv;struct iwl_trans *trans;int ret, addr_size; -void __iomem *const *table;u32 bar0;/* reassign our BAR 0 if invalid due to possible runtime PM races */
@@ -3657,22 +3656,15 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, } } - ret =pcim_iomap_regions_request_all (pdev,BIT (0 ),DRV_NAME ); + ret =pcim_request_all_regions (pdev,DRV_NAME );if (ret) { -dev_err (&pdev->dev,"pcim_iomap_regions_request_all failed\n" ); +dev_err (&pdev->dev,"pcim_request_all_regions failed\n" ); goto out_no_pci; } - table =pcim_iomap_table (pdev); -if (!table) { -dev_err (&pdev->dev,"pcim_iomap_table failed\n" ); - ret = -ENOMEM ; - goto out_no_pci; - } - - trans_pcie->hw_base = table[0 ]; + trans_pcie->hw_base =pcim_iomap (pdev,0 ,0 );if (!trans_pcie->hw_base) { -dev_err (&pdev->dev,"couldn't find IO mem in first BAR\n" ); +dev_err (&pdev->dev,"pcim_iomap failed\n" ); ret = -ENODEV ; goto out_no_pci; }
Signature · 1 line
2.45.2
PATCH v2 7/10 ntb: idt: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions_request_all() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with their successors, pcim_iomap() and pcim_request_all_regions()
--- drivers/ntb/hw/idt/ntb_hw_idt.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/ntb/hw/idt/ntb_hw_idt.c +9 -4
@@ -2671,15 +2671,20 @@ static int idt_init_pci(struct idt_ntb_dev *ndev)*/ pci_set_master (pdev); -/* Request all BARs resources and map BAR0 only */ - ret =pcim_iomap_regions_request_all (pdev,1 ,NTB_NAME ); +/* Request all BARs resources */ + ret =pcim_request_all_regions (pdev,NTB_NAME );if (ret !=0 ) {dev_err (&pdev->dev,"Failed to request resources\n" ); goto err_clear_master; } -/* Retrieve virtual address of BAR0 - PCI configuration space */ - ndev->cfgspc =pcim_iomap_table (pdev)[0 ]; +/* ioremap BAR0 - PCI configuration space */ + ndev->cfgspc =pcim_iomap (pdev,0 ,0 ); +if (!ndev->cfgspc) { +dev_err (&pdev->dev,"Failed to ioremap BAR 0\n" ); + ret = -ENOMEM ; + goto err_clear_master; + }/* Put the IDT driver data pointer to the PCI-device private pointer */ pci_set_drvdata (pdev, ndev);
Signature · 1 line
2.45.2
PATCH v2 8/10 serial: rp2: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions_request_all() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with their successors, pcim_iomap() and pcim_request_all_regions()
--- drivers/tty/serial/rp2.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/tty/serial/rp2.c +7 -5
@@ -698,7 +698,6 @@ static int rp2_probe(struct pci_dev *pdev,const struct firmware *fw;struct rp2_card *card;struct rp2_uart_port *ports; -void __iomem *const *bars;int rc; card =devm_kzalloc (&pdev->dev,sizeof (*card),GFP_KERNEL );
@@ -711,13 +710,16 @@ static int rp2_probe(struct pci_dev *pdev,if (rc)return rc; - rc =pcim_iomap_regions_request_all (pdev,0x03 ,DRV_NAME ); + rc =pcim_request_all_regions (pdev,DRV_NAME );if (rc)return rc; - bars =pcim_iomap_table (pdev); - card->bar0 = bars[0 ]; - card->bar1 = bars[1 ]; + card->bar0 =pcim_iomap (pdev,0 ,0 ); +if (!card->bar0) +return -ENOMEM ; + card->bar1 =pcim_iomap (pdev,1 ,0 ); +if (!card->bar1) +return -ENOMEM ; card->pdev = pdev;rp2_decode_cap (id, &card->n_ports, &card->smpte);
Signature · 1 line
2.45.2
PATCH v2 9/10 ALSA: korg1212: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions_request_all() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Replace these functions with their successors, pcim_iomap() and pcim_request_all_regions()
--- sound/pci/korg1212/korg1212.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/pci/korg1212/korg1212.c +4 -2
@@ -2106,7 +2106,7 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci)for (i=0 ; i<kAudioChannels; i++) korg1212->volumePhase[i] =0 ; - err =pcim_iomap_regions_request_all (pci,1 <<0 ,"korg1212" ); + err =pcim_request_all_regions (pci,"korg1212" );if (err <0 )return err;
@@ -2128,7 +2128,9 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci) korg1212->iomem2, iomem2_size, stateName[korg1212->cardState]); - korg1212->iobase =pcim_iomap_table (pci)[0 ]; + korg1212->iobase =pcim_iomap (pci,0 ,0 ); +if (!korg1212->iobase) +return -ENOMEM ; err = devm_request_irq(&pci->dev, pci->irq, snd_korg1212_interrupt, IRQF_SHARED,
Signature · 1 line
2.45.2
PATCH v2 10/10 PCI: Remove pcim_iomap_regions_request_all()
In reply to Philipp Stannerpcim_iomap_regions_request_all() had been deprecated in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
All users of this function have been ported to other interfaces by now.
Remove pcim_iomap_regions_request_all().
--- .../driver-api/driver-model/devres.rst | 1 - drivers/pci/devres.c | 56 ------------------- include/linux/pci.h | 2 - 3 files changed, 59 deletions(-)
Documentation/driver-api/driver-model/devres.rst +0 -1
@@ -394,7 +394,6 @@ PCI pcim_enable_device() : after success, all PCI ops become managed pcim_iomap() : do iomap() on a single BAR pcim_iomap_regions() : do request_region() and iomap() on multiple BARs - pcim_iomap_regions_request_all() : do request_region() on all and iomap() on multiple BARs pcim_iomap_table() : array of mapped addresses indexed by BAR pcim_iounmap() : do iounmap() on a single BAR pcim_iounmap_regions() : do iounmap() and release_region() on multiple BARs
drivers/pci/devres.c +0 -56
62 lines not on this page · raw message
include/linux/pci.h +0 -2
@@ -2294,8 +2294,6 @@ void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);void pcim_iounmap (struct pci_dev *pdev,void __iomem *addr);void __iomem *const *pcim_iomap_table (struct pci_dev *pdev);int pcim_iomap_regions (struct pci_dev *pdev,int mask,const char *name); -int pcim_iomap_regions_request_all (struct pci_dev *pdev,int mask, -const char *name);void pcim_iounmap_regions (struct pci_dev *pdev,int mask);void __iomem *pcim_iomap_range (struct pci_dev *pdev,int bar,unsigned long offset,unsigned long len);
Signature · 1 line
2.45.2