PCI: Remove pcim_iounmap_regions()
Subsystems (12)
v4 cover PCI: Remove pcim_iounmap_regions()
OK, so unfortunately it seems very challenging to reconcile the merge conflict pointed up by Serge between net-next and pci-devres regarding "ethernet: stmicro": A patch that applies to the net-next tree does not apply anymore to pci-devres (and vice versa).
So I actually think that it would be best if we just drop the portation of "ethernet: stmicro" for now and port it as the last user in v6.13.
That should then be trivial.
Changes in v4:
- Drop the "ethernet: stmicro: [...] patch since it doesn't apply to net-next, and making it apply to that prevents it from being applyable to PCI ._. (Serge, me)
- Instead, deprecate pcim_iounmap_regions() and keep "ethernet:
stimicro" as the last user for now. Perform the deprecation in the series' first patch. Remove the Reviewed-by's givin so far to that patch.
- ethernet: cavium: Use PTR_ERR_OR_ZERO(). (Andy)
- vdpa: solidrun (Bugfix) Correct wrong printf string (was "psnet" instead of
"snet"). (Christophe)
- vdpa: solidrun (Bugfix): Add missing blank line. (Andy)
- vdpa: solidrun (Portation): Use PTR_ERR_OR_ZERO(). (Andy)
- Apply Reviewed-by's from Andy and Xu Yilun.
Changes in v3:
- fpga/dfl-pci.c: remove now surplus wrapper around
pcim_iomap_region(). (Andy)
- block: mtip32xx: remove now surplus label. (Andy)
- vdpa: solidrun: Bugfix: Include forgotten place where stack UB occurs. (Andy, Christophe)
- Some minor wording improvements in commit messages. (Me)
Changes in v2:
- Add a fix for the UB stack usage bug in vdap/solidrun. Separate patch, put stable kernel on CC. (Christophe, Andy).
- Drop unnecessary pcim_release_region() in mtip32xx (Andy)
- Consequently, drop patch "PCI: Make pcim_release_region() a public function", since there's no user anymore. (obsoletes the squash requested by Damien).
- vdap/solidrun:
• make 'i' an 'unsigned short' (Andy, me)
• Use 'continue' to simplify loop (Andy)
• Remove leftover blank line
- Apply given Reviewed- / acked-bys (Andy, Damien, Bartosz)
Important things first:
This series is based on [1] and [2] which Bjorn Helgaas has currently queued for v6.12 in the PCI tree.
This series shall remove pcim_iounmap_regions() in order to make way to remove its brother, pcim_iomap_regions().
@Bjorn: Feel free to squash the PCI commits.
Regards,
P.
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Philipp Stanner (7):
PCI: Deprecate pcim_iounmap_regions() fpga/dfl-pci.c: Replace deprecated PCI functions
block: mtip32xx: Replace deprecated PCI functions
gpio: Replace deprecated PCI functions
ethernet: cavium: Replace deprecated PCI functions
vdpa: solidrun: Fix UB bug with devres
vdap: solidrun: Replace deprecated PCI functions
drivers/block/mtip32xx/mtip32xx.c | 16 +++-- drivers/fpga/dfl-pci.c | 16 ++--- drivers/gpio/gpio-merrifield.c | 14 ++--- .../net/ethernet/cavium/common/cavium_ptp.c | 6 +- drivers/pci/devres.c | 8 ++- drivers/vdpa/solidrun/snet_main.c | 59 ++++++++----------- include/linux/pci.h | 1 + 7 files changed, 51 insertions(+), 69 deletions(-)
Signature · 1 line
2.46.0
PATCH v4 1/7 PCI: Deprecate pcim_iounmap_regions()
The function pcim_iounmap_regions() is problematic because it uses a bitmask mechanism to release / iounmap multiple BARs at once. It, thus, prevents getting rid of the problematic iomap table mechanism which was deprecated in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Make pcim_iounmap_region() public as the successor of pcim_iounmap_regions().
Mark pcim_iounmap_regions() as deprecated.
--- drivers/pci/devres.c | 8 ++++++-- include/linux/pci.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/pci/devres.c +6 -2
@@ -771,7 +771,7 @@ EXPORT_SYMBOL(pcim_iomap_region);* Unmap a BAR and release its region manually. Only pass BARs that were * previously mapped by pcim_iomap_region(). */ -static void pcim_iounmap_region (struct pci_dev *pdev,int bar) +void pcim_iounmap_region (struct pci_dev *pdev,int bar) {struct pcim_addr_devres res_searched;
@@ -782,6 +782,7 @@ static void pcim_iounmap_region(struct pci_dev *pdev, int bar)devres_release (&pdev->dev, pcim_addr_resource_release, pcim_addr_resources_match, &res_searched); } +EXPORT_SYMBOL (pcim_iounmap_region);/** * pcim_iomap_regions - Request and iomap PCI BARs (DEPRECATED)
@@ -1013,11 +1014,14 @@ int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask,EXPORT_SYMBOL (pcim_iomap_regions_request_all);/** -* pcim_iounmap_regions - Unmap and release PCI BARs +* pcim_iounmap_regions - Unmap and release PCI BARs (DEPRECATED) * @pdev: PCI device to map IO resources for * @mask: Mask of BARs to unmap and release * * Unmap and release regions specified by @mask. +* +* This function is DEPRECATED. Do not use it in new code. +* Use pcim_iounmap_region() instead. */ void pcim_iounmap_regions (struct pci_dev *pdev,int mask) {
include/linux/pci.h +1 -0
@@ -2297,6 +2297,7 @@ void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);int pcim_request_region (struct pci_dev *pdev,int bar,const char *name);void __iomem *pcim_iomap_region (struct pci_dev *pdev,int bar,const char *name); +void pcim_iounmap_region (struct pci_dev *pdev,int bar);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);
Signature · 1 line
2.46.0
PATCH v4 2/7 fpga/dfl-pci.c: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_regions() and pcim_iomap_table() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Port dfl-pci.c to the successor, pcim_iomap_region().
Consistently, replace pcim_iounmap_regions() with pcim_iounmap_region().
--- drivers/fpga/dfl-pci.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/fpga/dfl-pci.c +4 -12
@@ -39,14 +39,6 @@ struct cci_drvdata {struct dfl_fpga_cdev *cdev;/* container device */ }; -static void __iomem *cci_pci_ioremap_bar0 (struct pci_dev *pcidev) -{ -if (pcim_iomap_regions (pcidev,BIT (0 ),DRV_NAME )) -return NULL ; - -return pcim_iomap_table (pcidev)[0 ]; -} -static int cci_pci_alloc_irq (struct pci_dev *pcidev) {int ret, nvec =pci_msix_vec_count (pcidev);
@@ -235,9 +227,9 @@ static int find_dfls_by_default(struct pci_dev *pcidev,u64 v;/* start to find Device Feature List from Bar 0 */ - base =cci_pci_ioremap_bar0 (pcidev); -if (!base) -return -ENOMEM ; + base =pcim_iomap_region (pcidev,0 ,DRV_NAME ); +if (IS_ERR (base)) +return PTR_ERR (base);/* * PF device has FME and Ports/AFUs, and VF device only has one
@@ -296,7 +288,7 @@ static int find_dfls_by_default(struct pci_dev *pcidev, }/* release I/O mappings for next step enumeration */ -pcim_iounmap_regions (pcidev,BIT (0 )); +pcim_iounmap_region (pcidev,0 );return ret; }
Signature · 1 line
2.46.0
PATCH v4 3/7 block: mtip32xx: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_regions() and pcim_iomap_table() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
In mtip32xx, these functions can easily be replaced by their respective successors, pcim_request_region() and pcim_iomap(). Moreover, the driver's calls to pcim_iounmap_regions() in probe()'s error path and in remove() are not necessary. Cleanup can be performed by PCI devres automatically.
Replace pcim_iomap_regions() and pcim_iomap_table().
Remove the calls to pcim_iounmap_regions().
--- drivers/block/mtip32xx/mtip32xx.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/block/mtip32xx/mtip32xx.c +7 -9
@@ -2716,7 +2716,9 @@ static int mtip_hw_init(struct driver_data *dd)int rv;unsigned long timeout, timetaken; - dd->mmio =pcim_iomap_table (dd->pdev)[MTIP_ABAR ]; + dd->mmio =pcim_iomap (dd->pdev,MTIP_ABAR ,0 ); +if (!dd->mmio) +return -ENOMEM ;mtip_detect_product (dd);if (dd->product_type ==MTIP_PRODUCT_UNKNOWN ) {
@@ -3722,14 +3724,14 @@ static int mtip_pci_probe(struct pci_dev *pdev, rv =pcim_enable_device (pdev);if (rv <0 ) {dev_err (&pdev->dev,"Unable to enable device\n" ); - goto iomap_err; + goto setmask_err; }/* Map BAR5 to memory. */ - rv =pcim_iomap_regions (pdev,1 <<MTIP_ABAR ,MTIP_DRV_NAME ); + rv =pcim_request_region (pdev,MTIP_ABAR ,MTIP_DRV_NAME );if (rv <0 ) { -dev_err (&pdev->dev,"Unable to map regions\n" ); - goto iomap_err; +dev_err (&pdev->dev,"Unable to request regions\n" ); + goto setmask_err; } rv =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 ));
@@ -3849,9 +3851,6 @@ static int mtip_pci_probe(struct pci_dev *pdev,drop_cpu (dd->work[2 ].cpu_binding); } setmask_err: -pcim_iounmap_regions (pdev,1 <<MTIP_ABAR ); - -iomap_err:kfree (dd);pci_set_drvdata (pdev,NULL );return rv;
@@ -3925,7 +3924,6 @@ static void mtip_pci_remove(struct pci_dev *pdev)pci_disable_msi (pdev); -pcim_iounmap_regions (pdev,1 <<MTIP_ABAR );pci_set_drvdata (pdev,NULL );put_disk (dd->disk);
Signature · 1 line
2.46.0
PATCH v4 4/7 gpio: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_regions() 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 those functions with calls to pcim_iomap_region().
--- drivers/gpio/gpio-merrifield.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpio/gpio-merrifield.c +7 -7
@@ -78,24 +78,24 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *idif (retval)return retval; - retval =pcim_iomap_regions (pdev,BIT (1 ) |BIT (0 ),pci_name (pdev)); -if (retval) -return dev_err_probe (dev, retval,"I/O memory mapping error\n" ); - - base =pcim_iomap_table (pdev)[1 ]; + base =pcim_iomap_region (pdev,1 ,pci_name (pdev)); +if (IS_ERR (base)) +return dev_err_probe (dev,PTR_ERR (base),"I/O memory mapping error\n" ); irq_base =readl (base +0 *sizeof (u32)); gpio_base =readl (base +1 *sizeof (u32));/* Release the IO mapping, since we already get the info from BAR1 */ -pcim_iounmap_regions (pdev,BIT (1 )); +pcim_iounmap_region (pdev,1 ); priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ; priv->dev = dev; - priv->reg_base =pcim_iomap_table (pdev)[0 ]; + priv->reg_base =pcim_iomap_region (pdev,0 ,pci_name (pdev)); +if (IS_ERR (priv->reg_base)) +return dev_err_probe (dev,PTR_ERR (base),"I/O memory mapping error\n" ); priv->pin_info.pin_ranges = mrfld_gpio_ranges; priv->pin_info.nranges =ARRAY_SIZE (mrfld_gpio_ranges);
Signature · 1 line
2.46.0
PATCH v4 5/7 ethernet: cavium: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_regions() and pcim_iomap_table() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
Furthermore, the driver contains an unneeded call to pcim_iounmap_regions() in its probe() function's error unwind path.
Replace the deprecated PCI functions with pcim_iomap_region().
Remove the unnecessary call to pcim_iounmap_regions().
--- drivers/net/ethernet/cavium/common/cavium_ptp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/cavium/common/cavium_ptp.c +2 -4
@@ -239,12 +239,11 @@ static int cavium_ptp_probe(struct pci_dev *pdev,if (err) goto error_free; - err =pcim_iomap_regions (pdev,1 <<PCI_PTP_BAR_NO ,pci_name (pdev)); + clock->reg_base =pcim_iomap_region (pdev,PCI_PTP_BAR_NO ,pci_name (pdev)); + err =PTR_ERR_OR_ZERO (clock->reg_base);if (err) goto error_free; - clock->reg_base =pcim_iomap_table (pdev)[PCI_PTP_BAR_NO ]; -spin_lock_init (&clock->spin_lock); cc = &clock->cycle_counter;
@@ -292,7 +291,6 @@ static int cavium_ptp_probe(struct pci_dev *pdev, clock_cfg =readq (clock->reg_base +PTP_CLOCK_CFG ); clock_cfg &= ~PTP_CLOCK_CFG_PTP_EN ;writeq (clock_cfg, clock->reg_base +PTP_CLOCK_CFG ); -pcim_iounmap_regions (pdev,1 <<PCI_PTP_BAR_NO ); error_free:devm_kfree (dev, clock);
Signature · 1 line
2.46.0
PATCH v4 6/7 vdpa: solidrun: Fix UB bug with devres
In reply to Philipp StannerIn psnet_open_pf_bar() and snet_open_vf_bar() a string later passed to pcim_iomap_regions() is placed on the stack. Neither pcim_iomap_regions() nor the functions it calls copy that string.
Should the string later ever be used, this, consequently, causes undefined behavior since the stack frame will by then have disappeared.
Fix the bug by allocating the strings on the heap through devm_kasprintf().
--- drivers/vdpa/solidrun/snet_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/vdpa/solidrun/snet_main.c +10 -4
@@ -555,7 +555,7 @@ static const struct vdpa_config_ops snet_config_ops = {static int psnet_open_pf_bar (struct pci_dev *pdev,struct psnet *psnet) { -char name[50 ]; +char *name;int ret, i, mask =0 ;/* We don't know which BAR will be used to communicate.. * We will map every bar with len > 0.
@@ -573,7 +573,10 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)return -ENODEV ; } -snprintf (name,sizeof (name),"psnet[%s]-bars" ,pci_name (pdev)); + name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"psnet[%s]-bars" ,pci_name (pdev)); +if (!name) +return -ENOMEM ; + ret =pcim_iomap_regions (pdev, mask, name);if (ret) {SNET_ERR (pdev,"Failed to request and map PCI BARs\n" );
@@ -590,10 +593,13 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)static int snet_open_vf_bar (struct pci_dev *pdev,struct snet *snet) { -char name[50 ]; +char *name;int ret; -snprintf (name,sizeof (name),"snet[%s]-bar" ,pci_name (pdev)); + name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"snet[%s]-bars" ,pci_name (pdev)); +if (!name) +return -ENOMEM ; +/* Request and map BAR */ ret =pcim_iomap_regions (pdev,BIT (snet->psnet->cfg.vf_bar), name);if (ret) {
Signature · 1 line
2.46.0
PATCH v4 7/7 vdap: solidrun: Replace deprecated PCI functions
In reply to Philipp Stannersolidrun utilizes pcim_iomap_regions(), which has been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"), among other things because it forces usage of quite a complicated bitmask mechanism. The bitmask handling code can entirely be removed by replacing pcim_iomap_regions() and pcim_iomap_table().
Replace pcim_iomap_regions() and pcim_iomap_table() with pcim_iomap_region().
--- drivers/vdpa/solidrun/snet_main.c | 53 +++++++++++-------------------- 1 file changed, 18 insertions(+), 35 deletions(-)
drivers/vdpa/solidrun/snet_main.c +18 -35
@@ -556,36 +556,25 @@ static const struct vdpa_config_ops snet_config_ops = {static int psnet_open_pf_bar (struct pci_dev *pdev,struct psnet *psnet) {char *name; -int ret, i, mask =0 ; +unsigned short i; + + name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"psnet[%s]-bars" ,pci_name (pdev)); +if (!name) +return -ENOMEM ; +/* We don't know which BAR will be used to communicate.. * We will map every bar with len > 0. * * Later, we will discover the BAR and unmap all other BARs. */ for (i =0 ; i <PCI_STD_NUM_BARS ; i++) { -if (pci_resource_len (pdev, i)) - mask |= (1 << i); - } - -/* No BAR can be used.. */ -if (!mask) { -SNET_ERR (pdev,"Failed to find a PCI BAR\n" ); -return -ENODEV ; - } - - name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"psnet[%s]-bars" ,pci_name (pdev)); -if (!name) -return -ENOMEM ; - - ret =pcim_iomap_regions (pdev, mask, name); -if (ret) { -SNET_ERR (pdev,"Failed to request and map PCI BARs\n" ); -return ret; - } - -for (i =0 ; i <PCI_STD_NUM_BARS ; i++) { -if (mask & (1 << i)) - psnet->bars[i] =pcim_iomap_table (pdev)[i]; +if (!pci_resource_len (pdev, i)) +continue ; + psnet->bars[i] =pcim_iomap_region (pdev, i, name); +if (IS_ERR (psnet->bars[i])) { +SNET_ERR (pdev,"Failed to request and map PCI BARs\n" ); +return PTR_ERR (psnet->bars[i]); + } }return 0 ;
@@ -594,21 +583,18 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)static int snet_open_vf_bar (struct pci_dev *pdev,struct snet *snet) {char *name; -int ret; name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"snet[%s]-bars" ,pci_name (pdev));if (!name)return -ENOMEM ;/* Request and map BAR */ - ret =pcim_iomap_regions (pdev,BIT (snet->psnet->cfg.vf_bar), name); -if (ret) { + snet->bar =pcim_iomap_region (pdev, snet->psnet->cfg.vf_bar, name); +if (IS_ERR (snet->bar)) {SNET_ERR (pdev,"Failed to request and map PCI BAR for a VF\n" ); -return ret; +return PTR_ERR (snet->bar); } - snet->bar =pcim_iomap_table (pdev)[snet->psnet->cfg.vf_bar]; -return 0 ; }
@@ -656,15 +642,12 @@ static int psnet_detect_bar(struct psnet *psnet, u32 off)static void psnet_unmap_unused_bars (struct pci_dev *pdev,struct psnet *psnet) { -int i, mask =0 ; +unsigned short i;for (i =0 ; i <PCI_STD_NUM_BARS ; i++) {if (psnet->bars[i] && i != psnet->barno) - mask |= (1 << i); +pcim_iounmap_region (pdev, i); } - -if (mask) -pcim_iounmap_regions (pdev, mask); }/* Read SNET config from PCI BAR */
Signature · 1 line
2.46.0
PS:
This series's title should now obviously be "*Mostly* Remove pcim_iounmap_regions()".
Quoted 92 lines · Philipp Stanner
OK, so unfortunately it seems very challenging to reconcile the merge conflict pointed up by Serge between net-next and pci-devres regarding
"ethernet: stmicro": A patch that applies to the net-next tree does not
apply anymore to pci-devres (and vice versa).So I actually think that it would be best if we just drop the portation
of "ethernet: stmicro" for now and port it as the last user in v6.13.That should then be trivial.
Changes in v4:
- Drop the "ethernet: stmicro: [...] patch since it doesn't apply to
net-next, and making it apply to that prevents it from being applyable to PCI ._. (Serge, me)
- Instead, deprecatepcim_iounmap_regions()and keep "ethernet:
stimicro" as the last user for now. Perform the deprecation in the
series' first patch. Remove the Reviewed-by's givin so far to that
patch.
- ethernet: cavium: UsePTR_ERR_OR_ZERO(). (Andy)
- vdpa: solidrun (Bugfix) Correct wrong printf string (was "psnet" instead of
"snet"). (Christophe)
- vdpa: solidrun (Bugfix): Add missing blank line. (Andy)
- vdpa: solidrun (Portation): UsePTR_ERR_OR_ZERO(). (Andy)
- Apply Reviewed-by's from Andy and Xu Yilun.Changes in v3:
-fpga/dfl-pci.c: remove now surplus wrapper aroundpcim_iomap_region(). (Andy)
- block: mtip32xx: remove now surplus label. (Andy)
- vdpa: solidrun: Bugfix: Include forgotten place where stack UB occurs. (Andy, Christophe)
- Some minor wording improvements in commit messages. (Me)Changes in v2:
- Add a fix for the UB stack usage bug in vdap/solidrun. Separate patch, put stable kernel on CC. (Christophe, Andy).
- Drop unnecessarypcim_release_region()in mtip32xx (Andy)
- Consequently, drop patch "PCI: Makepcim_release_region()a public
function", since there's no user anymore. (obsoletes the squash requested by Damien).
- vdap/solidrun:
• make 'i' an 'unsigned short' (Andy, me)
• Use 'continue' to simplify loop (Andy)
• Remove leftover blank line
- Apply given Reviewed- / acked-bys (Andy, Damien, Bartosz)Important things first:
This series is based on [1] and [2] which Bjorn Helgaas has currently queued for v6.12 in the PCI tree.This series shall remove
pcim_iounmap_regions()in order to make way to
remove its brother,pcim_iomap_regions().@Bjorn: Feel free to squash the PCI commits.
Regards,
P.[1]
https://lore.kernel.org/all/[email protected]/
[2]
https://lore.kernel.org/all/[email protected]/Philipp Stanner (7):
PCI: Deprecatepcim_iounmap_regions()fpga/dfl-pci.c: Replace deprecated PCI functions
block: mtip32xx: Replace deprecated PCI functions
gpio: Replace deprecated PCI functions
ethernet: cavium: Replace deprecated PCI functions
vdpa: solidrun: Fix UB bug with devres
vdap: solidrun: Replace deprecated PCI functionsdrivers/block/mtip32xx/mtip32xx.c | 16 +++-- drivers/fpga/dfl-pci.c | 16 ++--- drivers/gpio/gpio-merrifield.c | 14 ++--- .../net/ethernet/cavium/common/cavium_ptp.c | 6 +- drivers/pci/devres.c | 8 ++- drivers/vdpa/solidrun/snet_main.c | 59 ++++++++--------- --
include/linux/pci.h | 1 +7 files changed, 51 insertions(+), 69 deletions(-)
Re: [PATCH v4 3/7] block: mtip32xx: Replace deprecated PCI functions
In reply to Philipp StannerQuoted 10 lines · Philipp Stanner
pcim_iomap_regions()andpcim_iomap_table()have been deprecated by the PCI subsystem in commite354bb84a4c1("PCI: Deprecatepcim_iomap_table(),pcim_iomap_regions_request_all()").In mtip32xx, these functions can easily be replaced by their respective successors,
pcim_request_region()andpcim_iomap(). Moreover, the driver's calls topcim_iounmap_regions()in probe()'s error path and inremove()are not necessary. Cleanup can be performed by PCI devres automatically.
Quoted 3 lines
Replace
pcim_iomap_regions()andpcim_iomap_table().Remove the calls to
pcim_iounmap_regions().
Looks fine to me - since it depends on other trees, feel free to take it through those:
Signature · 1 line
Jens Axboe
Re: [PATCH v4 5/7] ethernet: cavium: Replace deprecated PCI functions
In reply to Philipp StannerQuoted 40 lines · Philipp Stanner
pcim_iomap_regions()andpcim_iomap_table()have been deprecated by the PCI subsystem in commite354bb84a4c1("PCI: Deprecatepcim_iomap_table(),pcim_iomap_regions_request_all()").Furthermore, the driver contains an unneeded call to
pcim_iounmap_regions()in itsprobe()function's error unwind path.Replace the deprecated PCI functions with
pcim_iomap_region().Remove the unnecessary call to
pcim_iounmap_regions().Signed-off-by Philipp Stanner <[email protected]>---
drivers/net/ethernet/cavium/common/cavium_ptp.c | 6 ++----1 file changed, 2 insertions(+), 4 deletions(-)drivers/net/ethernet/cavium/common/cavium_ptp.c +0
-0@@ -239,12 +239,11 @@ static int cavium_ptp_probe(struct pci_dev *pdev, if (err) goto error_free;drivers/net/ethernet/cavium/common/cavium_ptp.c +0
-1- err = pcim_iomap_regions(pdev, 1 << PCI_PTP_BAR_NO,
pci_name(pdev));drivers/net/ethernet/cavium/common/cavium_ptp.c +1
-0+ clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO,
pci_name(pdev));drivers/net/ethernet/cavium/common/cavium_ptp.c +1
-0+ err =PTR_ERR_OR_ZERO (clock->reg_base);if (err)
gotoerror_free;drivers/net/ethernet/cavium/common/cavium_ptp.c +0
-2- clock->reg_base =pcim_iomap_table (pdev)[PCI_PTP_BAR_NO ]; -
spin_lock_init(&clock->spin_lock);
cc =&clock->cycle_counter;
drivers/net/ethernet/cavium/common/cavium_ptp.c static int cavium_ptp_probe(struct pci_dev *pdev, · line 295
Quoted 4 lines
drivers/net/ethernet/cavium/common/cavium_ptp.c +0
-1@@ -292,7 +291,6 @@ static int cavium_ptp_probe(struct pci_dev *pdev, clock_cfg = readq(clock->reg_base + PTP_CLOCK_CFG); clock_cfg &= ~PTP_CLOCK_CFG_PTP_EN; writeq(clock_cfg, clock->reg_base + PTP_CLOCK_CFG); -pcim_iounmap_regions (pdev,1 <<PCI_PTP_BAR_NO );
I think I removed that by accident – thinking about it, we should not remove it since the driver later returns 0 from its probe(). So we should not keep blocking the region.
Has to be addressed in v5.
P.
Quoted 3 lines
error_free:
devm_kfree(dev, clock);
Re: [PATCH v4 3/7] block: mtip32xx: Replace deprecated PCI functions
In reply to Jens AxboeQuoted 16 lines · Jens Axboe
Quoted 15 lines · Philipp Stanner
pcim_iomap_regions()andpcim_iomap_table()have been deprecated by the
PCI subsystem in commite354bb84a4c1("PCI: Deprecatepcim_iomap_table(),pcim_iomap_regions_request_all()").In mtip32xx, these functions can easily be replaced by their respective
successors,pcim_request_region()andpcim_iomap(). Moreover, the driver's calls topcim_iounmap_regions()in probe()'s error path and inremove()are not necessary. Cleanup can be performed by PCI devres automatically.Replace
pcim_iomap_regions()andpcim_iomap_table().
Quoted 7 lines
Quoted 1 line
Remove the calls to
pcim_iounmap_regions().Looks fine to me - since it depends on other trees, feel free to take it
through those:Reviewed-by Jens Axboe <[email protected]>
Thank you for the review.
I have to provide a v5 because of an issue in another patch. While I'm at it, I'd modify this patch here so that the comment above pcim_request_region() is descriptive of the actual events:
- /* Map BAR5 to memory. */
+ /* Request BAR5. */
I'd keep your Reviewed-by if that's OK. It's the only change I'd do.
Regards,
P.
Jens Axboe
maintainerRe: [PATCH v4 3/7] block: mtip32xx: Replace deprecated PCI functions
Quoted 35 lines · Philipp Stanner
Quoted 16 lines · Jens Axboe
Quoted 15 lines · Philipp Stanner
pcim_iomap_regions()andpcim_iomap_table()have been deprecated by the
PCI subsystem in commite354bb84a4c1("PCI: Deprecatepcim_iomap_table(),pcim_iomap_regions_request_all()").In mtip32xx, these functions can easily be replaced by their respective
successors,pcim_request_region()andpcim_iomap(). Moreover, the driver's calls topcim_iounmap_regions()in probe()'s error path and inremove()are not necessary. Cleanup can be performed by PCI devres automatically.Replace
pcim_iomap_regions()andpcim_iomap_table().Quoted 7 lines
Quoted 1 line
Remove the calls to
pcim_iounmap_regions().Looks fine to me - since it depends on other trees, feel free to take it
through those:Reviewed-by Jens Axboe <[email protected]>Thank you for the review.
I have to provide a v5 because of an issue in another patch. While I'm at it, I'd modify this patch here so that the comment above
pcim_request_region()is descriptive of the actual events:(quoted diff) +1
-1- /* Map BAR5 to memory. */ + /* Request BAR5. */
Quoted 1 line
I'd keep your Reviewed-by if that's OK. It's the only change I'd do.
That's fine.
Signature · 1 line
Jens Axboe