Skip to content

Commit d140f80

Browse files
Philipp Stannerbjorn-helgaas
authored andcommitted
PCI: Deprecate pcim_iomap_regions() in favor of pcim_iomap_region()
pcim_iomap_regions() is a complicated function that uses a bit mask to determine the BARs the user wishes to request and ioremap. Almost all users only ever set a single bit in that mask, making that mechanism questionable. pcim_iomap_region() is now available as a more simple replacement. Make pcim_iomap_region() a public function. Mark pcim_iomap_regions() as deprecated. Link: https://lore.kernel.org/r/20240807083018.8734-2-pstanner@redhat.com Signed-off-by: Philipp Stanner <pstanner@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 89121e5 commit d140f80

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/pci/devres.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ EXPORT_SYMBOL(pcim_iounmap);
728728
* Mapping and region will get automatically released on driver detach. If
729729
* desired, release manually only with pcim_iounmap_region().
730730
*/
731-
static void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
731+
void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
732732
const char *name)
733733
{
734734
int ret;
@@ -761,6 +761,7 @@ static void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
761761

762762
return IOMEM_ERR_PTR(ret);
763763
}
764+
EXPORT_SYMBOL(pcim_iomap_region);
764765

765766
/**
766767
* pcim_iounmap_region - Unmap and release a PCI BAR
@@ -783,14 +784,17 @@ static void pcim_iounmap_region(struct pci_dev *pdev, int bar)
783784
}
784785

785786
/**
786-
* pcim_iomap_regions - Request and iomap PCI BARs
787+
* pcim_iomap_regions - Request and iomap PCI BARs (DEPRECATED)
787788
* @pdev: PCI device to map IO resources for
788789
* @mask: Mask of BARs to request and iomap
789790
* @name: Name associated with the requests
790791
*
791792
* Returns: 0 on success, negative error code on failure.
792793
*
793794
* Request and iomap regions specified by @mask.
795+
*
796+
* This function is DEPRECATED. Do not use it in new code.
797+
* Use pcim_iomap_region() instead.
794798
*/
795799
int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name)
796800
{

include/linux/pci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,8 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass,
22902290
#endif
22912291

22922292
void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
2293+
void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
2294+
const char *name);
22932295
void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
22942296
void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
22952297
int pcim_request_region(struct pci_dev *pdev, int bar, const char *name);

0 commit comments

Comments
 (0)