* [PATCH 1/2] PCI: Make pcim_request_all_regions() a public function
@ 2024-07-31 12:34 Philipp Stanner
2024-07-31 12:34 ` [PATCH 2/2] ata: ahci: Remove deprecated PCI functions Philipp Stanner
2024-07-31 20:02 ` [PATCH 1/2] PCI: Make pcim_request_all_regions() a public function Bjorn Helgaas
0 siblings, 2 replies; 3+ messages in thread
From: Philipp Stanner @ 2024-07-31 12:34 UTC (permalink / raw)
To: Damien Le Moal, Niklas Cassel, Bjorn Helgaas
Cc: linux-ide, linux-kernel, linux-pci, Philipp Stanner
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.
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/pci/devres.c | 3 ++-
include/linux/pci.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
index 3780a9f9ec00..0ec2b23e6cac 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -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
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 4cf89a4b4cbc..5b5856ba63e1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -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);
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] ata: ahci: Remove deprecated PCI functions
2024-07-31 12:34 [PATCH 1/2] PCI: Make pcim_request_all_regions() a public function Philipp Stanner
@ 2024-07-31 12:34 ` Philipp Stanner
2024-07-31 20:02 ` [PATCH 1/2] PCI: Make pcim_request_all_regions() a public function Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Philipp Stanner @ 2024-07-31 12:34 UTC (permalink / raw)
To: Damien Le Moal, Niklas Cassel, Bjorn Helgaas
Cc: linux-ide, linux-kernel, linux-pci, Philipp Stanner
pcim_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 in ahci with their successors,
pcim_request_all_regions() and pcim_iomap().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/ata/acard-ahci.c | 6 ++++--
drivers/ata/ahci.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c
index 547f56341705..3999305b5356 100644
--- a/drivers/ata/acard-ahci.c
+++ b/drivers/ata/acard-ahci.c
@@ -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_id
if (!(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);
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index a05c17249448..905af6b68d80 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -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);
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] PCI: Make pcim_request_all_regions() a public function
2024-07-31 12:34 [PATCH 1/2] PCI: Make pcim_request_all_regions() a public function Philipp Stanner
2024-07-31 12:34 ` [PATCH 2/2] ata: ahci: Remove deprecated PCI functions Philipp Stanner
@ 2024-07-31 20:02 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2024-07-31 20:02 UTC (permalink / raw)
To: Philipp Stanner
Cc: Damien Le Moal, Niklas Cassel, Bjorn Helgaas, linux-ide,
linux-kernel, linux-pci
On Wed, Jul 31, 2024 at 02:34:54PM +0200, Philipp Stanner wrote:
> 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.
pcim_iomap_regions_request_all() is only used by a dozen or so
drivers. Can we convert them all at once to consolidate reviewing
them? Or are the others harder so we have to do this piece-meal?
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> ---
> drivers/pci/devres.c | 3 ++-
> include/linux/pci.h | 1 +
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
> index 3780a9f9ec00..0ec2b23e6cac 100644
> --- a/drivers/pci/devres.c
> +++ b/drivers/pci/devres.c
> @@ -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
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 4cf89a4b4cbc..5b5856ba63e1 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -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);
> --
> 2.45.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-31 20:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 12:34 [PATCH 1/2] PCI: Make pcim_request_all_regions() a public function Philipp Stanner
2024-07-31 12:34 ` [PATCH 2/2] ata: ahci: Remove deprecated PCI functions Philipp Stanner
2024-07-31 20:02 ` [PATCH 1/2] PCI: Make pcim_request_all_regions() a public function Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox