* [PATCH v7 1/5] PCI: Deprecate pcim_iounmap_regions()
2024-10-14 7:53 [PATCH v7 0/5] PCI: Remove most pcim_iounmap_regions() users Philipp Stanner
@ 2024-10-14 7:53 ` Philipp Stanner
2024-10-14 7:53 ` [PATCH v7 2/5] fpga/dfl-pci.c: Replace deprecated PCI functions Philipp Stanner
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Philipp Stanner @ 2024-10-14 7:53 UTC (permalink / raw)
To: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Bjorn Helgaas, Richard Cochran, Damien Le Moal, Hannes Reinecke,
Al Viro, Keith Busch, Philipp Stanner, Li Zetao
Cc: linux-block, linux-kernel, linux-fpga, linux-gpio, netdev,
linux-pci
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_iomap_regions() as deprecated.
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/pci/devres.c | 8 ++++++--
include/linux/pci.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
index b133967faef8..a486bce18e0d 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -773,7 +773,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;
@@ -784,6 +784,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)
@@ -1015,11 +1016,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)
{
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 573b4c4c2be6..c4221aca20f9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2296,6 +2296,7 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass,
void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
const char *name);
+void pcim_iounmap_region(struct pci_dev *pdev, int bar);
void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
int pcim_request_region(struct pci_dev *pdev, int bar, const char *name);
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 2/5] fpga/dfl-pci.c: Replace deprecated PCI functions
2024-10-14 7:53 [PATCH v7 0/5] PCI: Remove most pcim_iounmap_regions() users Philipp Stanner
2024-10-14 7:53 ` [PATCH v7 1/5] PCI: Deprecate pcim_iounmap_regions() Philipp Stanner
@ 2024-10-14 7:53 ` Philipp Stanner
2024-10-14 7:53 ` [PATCH v7 3/5] block: mtip32xx: " Philipp Stanner
` (2 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Philipp Stanner @ 2024-10-14 7:53 UTC (permalink / raw)
To: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Bjorn Helgaas, Richard Cochran, Damien Le Moal, Hannes Reinecke,
Al Viro, Keith Busch, Philipp Stanner, Li Zetao
Cc: linux-block, linux-kernel, linux-fpga, linux-gpio, netdev,
linux-pci
pcim_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().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Acked-by: Xu Yilun <yilun.xu@intel.com>
---
drivers/fpga/dfl-pci.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index 80cac3a5f976..602807d6afcc 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -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;
}
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 3/5] block: mtip32xx: Replace deprecated PCI functions
2024-10-14 7:53 [PATCH v7 0/5] PCI: Remove most pcim_iounmap_regions() users Philipp Stanner
2024-10-14 7:53 ` [PATCH v7 1/5] PCI: Deprecate pcim_iounmap_regions() Philipp Stanner
2024-10-14 7:53 ` [PATCH v7 2/5] fpga/dfl-pci.c: Replace deprecated PCI functions Philipp Stanner
@ 2024-10-14 7:53 ` Philipp Stanner
2024-10-14 7:53 ` [PATCH v7 4/5] gpio: " Philipp Stanner
2024-10-14 7:53 ` [PATCH v7 5/5] ethernet: cavium: " Philipp Stanner
4 siblings, 0 replies; 12+ messages in thread
From: Philipp Stanner @ 2024-10-14 7:53 UTC (permalink / raw)
To: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Bjorn Helgaas, Richard Cochran, Damien Le Moal, Hannes Reinecke,
Al Viro, Keith Busch, Philipp Stanner, Li Zetao
Cc: linux-block, linux-kernel, linux-fpga, linux-gpio, netdev,
linux-pci
pcim_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().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
---
drivers/block/mtip32xx/mtip32xx.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 223faa9d5ffd..a10a87609310 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2701,7 +2701,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) {
@@ -3707,14 +3709,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);
+ /* Request BAR5. */
+ 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));
@@ -3834,9 +3836,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;
@@ -3910,7 +3909,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);
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 4/5] gpio: Replace deprecated PCI functions
2024-10-14 7:53 [PATCH v7 0/5] PCI: Remove most pcim_iounmap_regions() users Philipp Stanner
` (2 preceding siblings ...)
2024-10-14 7:53 ` [PATCH v7 3/5] block: mtip32xx: " Philipp Stanner
@ 2024-10-14 7:53 ` Philipp Stanner
2024-10-14 7:59 ` Bartosz Golaszewski
2024-10-14 12:13 ` Simon Horman
2024-10-14 7:53 ` [PATCH v7 5/5] ethernet: cavium: " Philipp Stanner
4 siblings, 2 replies; 12+ messages in thread
From: Philipp Stanner @ 2024-10-14 7:53 UTC (permalink / raw)
To: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Bjorn Helgaas, Richard Cochran, Damien Le Moal, Hannes Reinecke,
Al Viro, Keith Busch, Philipp Stanner, Li Zetao
Cc: linux-block, linux-kernel, linux-fpga, linux-gpio, netdev,
linux-pci, Bartosz Golaszewski
pcim_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().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-merrifield.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index 421d7e3a6c66..274afcba31e6 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -78,24 +78,24 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
if (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);
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v7 4/5] gpio: Replace deprecated PCI functions
2024-10-14 7:53 ` [PATCH v7 4/5] gpio: " Philipp Stanner
@ 2024-10-14 7:59 ` Bartosz Golaszewski
2024-10-14 8:08 ` Philipp Stanner
2024-10-14 12:13 ` Simon Horman
1 sibling, 1 reply; 12+ messages in thread
From: Bartosz Golaszewski @ 2024-10-14 7:59 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Bjorn Helgaas, Richard Cochran,
Damien Le Moal, Hannes Reinecke, Al Viro, Keith Busch, Li Zetao,
linux-block, linux-kernel, linux-fpga, linux-gpio, netdev,
linux-pci, Bartosz Golaszewski
On Mon, Oct 14, 2024 at 9:53 AM Philipp Stanner <pstanner@redhat.com> wrote:
>
> pcim_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().
>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
> Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
This is part of a larger series so I acked it previously but at second
glance it doesn't look like it depends on anything that comes before?
Should it have been sent separately to the GPIO tree? Should I pick it
up independently?
Bart
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 4/5] gpio: Replace deprecated PCI functions
2024-10-14 7:59 ` Bartosz Golaszewski
@ 2024-10-14 8:08 ` Philipp Stanner
2024-10-14 8:15 ` Bartosz Golaszewski
0 siblings, 1 reply; 12+ messages in thread
From: Philipp Stanner @ 2024-10-14 8:08 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Bjorn Helgaas, Richard Cochran,
Damien Le Moal, Hannes Reinecke, Al Viro, Keith Busch, Li Zetao,
linux-block, linux-kernel, linux-fpga, linux-gpio, netdev,
linux-pci, Bartosz Golaszewski
On Mon, 2024-10-14 at 09:59 +0200, Bartosz Golaszewski wrote:
> On Mon, Oct 14, 2024 at 9:53 AM Philipp Stanner <pstanner@redhat.com>
> wrote:
> >
> > pcim_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().
> >
> > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > Reviewed-by: Andy Shevchenko <andy@kernel.org>
> > Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > ---
>
> This is part of a larger series so I acked it previously but at
> second
> glance it doesn't look like it depends on anything that comes before?
> Should it have been sent separately to the GPIO tree? Should I pick
> it
> up independently?
Thx for the offer, but it depends on pcim_iounmap_region(), which only
becomes a public symbol through patch No.1 of this series :)
P.
>
> Bart
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 4/5] gpio: Replace deprecated PCI functions
2024-10-14 8:08 ` Philipp Stanner
@ 2024-10-14 8:15 ` Bartosz Golaszewski
2024-10-14 8:27 ` Philipp Stanner
0 siblings, 1 reply; 12+ messages in thread
From: Bartosz Golaszewski @ 2024-10-14 8:15 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Bjorn Helgaas, Richard Cochran,
Damien Le Moal, Hannes Reinecke, Al Viro, Keith Busch, Li Zetao,
linux-block, linux-kernel, linux-fpga, linux-gpio, netdev,
linux-pci, Bartosz Golaszewski
On Mon, Oct 14, 2024 at 10:08 AM Philipp Stanner <pstanner@redhat.com> wrote:
>
> On Mon, 2024-10-14 at 09:59 +0200, Bartosz Golaszewski wrote:
> > On Mon, Oct 14, 2024 at 9:53 AM Philipp Stanner <pstanner@redhat.com>
> > wrote:
> > >
> > > pcim_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().
> > >
> > > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > > Reviewed-by: Andy Shevchenko <andy@kernel.org>
> > > Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > > ---
> >
> > This is part of a larger series so I acked it previously but at
> > second
> > glance it doesn't look like it depends on anything that comes before?
> > Should it have been sent separately to the GPIO tree? Should I pick
> > it
> > up independently?
>
> Thx for the offer, but it depends on pcim_iounmap_region(), which only
> becomes a public symbol through patch No.1 of this series :)
>
Then a hint: to make it more obvious to maintainers, I'd change the
commit title for patch 1 to say explicitly it makes this function
public. In fact: I'd split it and the deprecation into two separate
patches.
Bart
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 4/5] gpio: Replace deprecated PCI functions
2024-10-14 8:15 ` Bartosz Golaszewski
@ 2024-10-14 8:27 ` Philipp Stanner
0 siblings, 0 replies; 12+ messages in thread
From: Philipp Stanner @ 2024-10-14 8:27 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Bjorn Helgaas, Richard Cochran,
Damien Le Moal, Hannes Reinecke, Al Viro, Keith Busch, Li Zetao,
linux-block, linux-kernel, linux-fpga, linux-gpio, netdev,
linux-pci, Bartosz Golaszewski
On Mon, 2024-10-14 at 10:15 +0200, Bartosz Golaszewski wrote:
> On Mon, Oct 14, 2024 at 10:08 AM Philipp Stanner
> <pstanner@redhat.com> wrote:
> >
> > On Mon, 2024-10-14 at 09:59 +0200, Bartosz Golaszewski wrote:
> > > On Mon, Oct 14, 2024 at 9:53 AM Philipp Stanner
> > > <pstanner@redhat.com>
> > > wrote:
> > > >
> > > > pcim_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().
> > > >
> > > > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > > > Reviewed-by: Andy Shevchenko <andy@kernel.org>
> > > > Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > > > ---
> > >
> > > This is part of a larger series so I acked it previously but at
> > > second
> > > glance it doesn't look like it depends on anything that comes
> > > before?
> > > Should it have been sent separately to the GPIO tree? Should I
> > > pick
> > > it
> > > up independently?
> >
> > Thx for the offer, but it depends on pcim_iounmap_region(), which
> > only
> > becomes a public symbol through patch No.1 of this series :)
> >
>
> Then a hint: to make it more obvious to maintainers, I'd change the
> commit title for patch 1 to say explicitly it makes this function
> public. In fact: I'd split it and the deprecation into two separate
> patches.
Yeah, good idea. The maintainer could squash then if two atomic patches
are deemed undesirable.
Noted.
Thank you!
P.
>
> Bart
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 4/5] gpio: Replace deprecated PCI functions
2024-10-14 7:53 ` [PATCH v7 4/5] gpio: " Philipp Stanner
2024-10-14 7:59 ` Bartosz Golaszewski
@ 2024-10-14 12:13 ` Simon Horman
2024-10-14 12:59 ` Philipp Stanner
1 sibling, 1 reply; 12+ messages in thread
From: Simon Horman @ 2024-10-14 12:13 UTC (permalink / raw)
To: Philipp Stanner
Cc: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Bjorn Helgaas, Richard Cochran, Damien Le Moal, Hannes Reinecke,
Al Viro, Keith Busch, Li Zetao, linux-block, linux-kernel,
linux-fpga, linux-gpio, netdev, linux-pci, Bartosz Golaszewski
On Mon, Oct 14, 2024 at 09:53:25AM +0200, Philipp Stanner wrote:
> pcim_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().
>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
> Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> drivers/gpio/gpio-merrifield.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
> index 421d7e3a6c66..274afcba31e6 100644
> --- a/drivers/gpio/gpio-merrifield.c
> +++ b/drivers/gpio/gpio-merrifield.c
> @@ -78,24 +78,24 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
> if (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");
Hi Philipp,
There seems to be a mismatch in the use of priv->reg_base and base above.
Should the above use PTR_ERR(priv->reg_base) instead of PTR_ERR(base)?
>
> priv->pin_info.pin_ranges = mrfld_gpio_ranges;
> priv->pin_info.nranges = ARRAY_SIZE(mrfld_gpio_ranges);
> --
> 2.46.2
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 4/5] gpio: Replace deprecated PCI functions
2024-10-14 12:13 ` Simon Horman
@ 2024-10-14 12:59 ` Philipp Stanner
0 siblings, 0 replies; 12+ messages in thread
From: Philipp Stanner @ 2024-10-14 12:59 UTC (permalink / raw)
To: Simon Horman
Cc: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Bjorn Helgaas, Richard Cochran, Damien Le Moal, Hannes Reinecke,
Al Viro, Keith Busch, Li Zetao, linux-block, linux-kernel,
linux-fpga, linux-gpio, netdev, linux-pci, Bartosz Golaszewski
On Mon, 2024-10-14 at 13:13 +0100, Simon Horman wrote:
> On Mon, Oct 14, 2024 at 09:53:25AM +0200, Philipp Stanner wrote:
> > pcim_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().
> >
> > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > Reviewed-by: Andy Shevchenko <andy@kernel.org>
> > Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > ---
> > drivers/gpio/gpio-merrifield.c | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-
> > merrifield.c
> > index 421d7e3a6c66..274afcba31e6 100644
> > --- a/drivers/gpio/gpio-merrifield.c
> > +++ b/drivers/gpio/gpio-merrifield.c
> > @@ -78,24 +78,24 @@ static int mrfld_gpio_probe(struct pci_dev
> > *pdev, const struct pci_device_id *id
> > if (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");
>
> Hi Philipp,
>
> There seems to be a mismatch in the use of priv->reg_base and base
> above.
> Should the above use PTR_ERR(priv->reg_base) instead of
> PTR_ERR(base)?
uff, yes, good catch!
Will fix, thx
P.
>
> >
> > priv->pin_info.pin_ranges = mrfld_gpio_ranges;
> > priv->pin_info.nranges = ARRAY_SIZE(mrfld_gpio_ranges);
> > --
> > 2.46.2
> >
> >
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v7 5/5] ethernet: cavium: Replace deprecated PCI functions
2024-10-14 7:53 [PATCH v7 0/5] PCI: Remove most pcim_iounmap_regions() users Philipp Stanner
` (3 preceding siblings ...)
2024-10-14 7:53 ` [PATCH v7 4/5] gpio: " Philipp Stanner
@ 2024-10-14 7:53 ` Philipp Stanner
4 siblings, 0 replies; 12+ messages in thread
From: Philipp Stanner @ 2024-10-14 7:53 UTC (permalink / raw)
To: Jens Axboe, Wu Hao, Tom Rix, Moritz Fischer, Xu Yilun,
Andy Shevchenko, Linus Walleij, Bartosz Golaszewski,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Bjorn Helgaas, Richard Cochran, Damien Le Moal, Hannes Reinecke,
Al Viro, Keith Busch, Philipp Stanner, Li Zetao
Cc: linux-block, linux-kernel, linux-fpga, linux-gpio, netdev,
linux-pci
pcim_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().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
---
drivers/net/ethernet/cavium/common/cavium_ptp.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/cavium/common/cavium_ptp.c b/drivers/net/ethernet/cavium/common/cavium_ptp.c
index 9fd717b9cf69..984f0dd7b62e 100644
--- a/drivers/net/ethernet/cavium/common/cavium_ptp.c
+++ b/drivers/net/ethernet/cavium/common/cavium_ptp.c
@@ -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,7 @@ 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);
+ pcim_iounmap_region(pdev, PCI_PTP_BAR_NO);
error_free:
devm_kfree(dev, clock);
--
2.46.2
^ permalink raw reply related [flat|nested] 12+ messages in thread