aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/devres.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/devres.c b/lib/devres.c
index eb38849aa717..b1d336ce7f3d 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -296,5 +296,31 @@ int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name)
296 return rc; 296 return rc;
297} 297}
298EXPORT_SYMBOL(pcim_iomap_regions); 298EXPORT_SYMBOL(pcim_iomap_regions);
299
300/**
301 * pcim_iounmap_regions - Unmap and release PCI BARs
302 * @pdev: PCI device to map IO resources for
303 * @mask: Mask of BARs to unmap and release
304 *
305 * Unamp and release regions specified by @mask.
306 */
307void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask)
308{
309 void __iomem * const *iomap;
310 int i;
311
312 iomap = pcim_iomap_table(pdev);
313 if (!iomap)
314 return;
315
316 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
317 if (!(mask & (1 << i)))
318 continue;
319
320 pcim_iounmap(pdev, iomap[i]);
321 pci_release_region(pdev, i);
322 }
323}
324EXPORT_SYMBOL(pcim_iounmap_regions);
299#endif 325#endif
300#endif 326#endif