forked from mirrors/linux
		
	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>
This commit is contained in:
		
							parent
							
								
									89121e5d08
								
							
						
					
					
						commit
						d140f80f60
					
				
					 2 changed files with 8 additions and 2 deletions
				
			
		|  | @ -728,7 +728,7 @@ EXPORT_SYMBOL(pcim_iounmap); | ||||||
|  * Mapping and region will get automatically released on driver detach. If |  * Mapping and region will get automatically released on driver detach. If | ||||||
|  * desired, release manually only with pcim_iounmap_region(). |  * desired, release manually only with pcim_iounmap_region(). | ||||||
|  */ |  */ | ||||||
| static void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar, | void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar, | ||||||
| 				       const char *name) | 				       const char *name) | ||||||
| { | { | ||||||
| 	int ret; | 	int ret; | ||||||
|  | @ -761,6 +761,7 @@ static void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar, | ||||||
| 
 | 
 | ||||||
| 	return IOMEM_ERR_PTR(ret); | 	return IOMEM_ERR_PTR(ret); | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(pcim_iomap_region); | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * pcim_iounmap_region - Unmap and release a PCI BAR |  * pcim_iounmap_region - Unmap and release a PCI BAR | ||||||
|  | @ -783,7 +784,7 @@ static void pcim_iounmap_region(struct pci_dev *pdev, int bar) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * pcim_iomap_regions - Request and iomap PCI BARs |  * pcim_iomap_regions - Request and iomap PCI BARs (DEPRECATED) | ||||||
|  * @pdev: PCI device to map IO resources for |  * @pdev: PCI device to map IO resources for | ||||||
|  * @mask: Mask of BARs to request and iomap |  * @mask: Mask of BARs to request and iomap | ||||||
|  * @name: Name associated with the requests |  * @name: Name associated with the requests | ||||||
|  | @ -791,6 +792,9 @@ static void pcim_iounmap_region(struct pci_dev *pdev, int bar) | ||||||
|  * Returns: 0 on success, negative error code on failure. |  * Returns: 0 on success, negative error code on failure. | ||||||
|  * |  * | ||||||
|  * Request and iomap regions specified by @mask. |  * Request and iomap regions specified by @mask. | ||||||
|  |  * | ||||||
|  |  * This function is DEPRECATED. Do not use it in new code. | ||||||
|  |  * Use pcim_iomap_region() instead. | ||||||
|  */ |  */ | ||||||
| int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name) | int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -2290,6 +2290,8 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass, | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); | 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(struct pci_dev *pdev, void __iomem *addr); | void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); | ||||||
| void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); | void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); | ||||||
| int pcim_request_region(struct pci_dev *pdev, int bar, const char *name); | int pcim_request_region(struct pci_dev *pdev, int bar, const char *name); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Philipp Stanner
						Philipp Stanner