diff options
| author | Johannes Thumshirn <jthumshirn@suse.de> | 2016-06-07 03:44:01 -0400 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-06-21 18:09:06 -0400 |
| commit | be9d2e8927cef02076bb7b5b2637cd9f4be2e8df (patch) | |
| tree | 6acf7378fc70285df0a0882129b6fd752c592fb6 /include/linux/pci.h | |
| parent | 644a544fd9bcd65f524768b85ab22f62ed08e107 (diff) | |
PCI: Add helpers to request/release memory and I/O regions
Add helpers to request and release a device's memory or I/O regions.
With these helpers in place, one does not need to select a device's memory
or I/O regions with pci_select_bars() prior to requesting or releasing
them.
Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include/linux/pci.h')
| -rw-r--r-- | include/linux/pci.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 9c201d4dbd51..6af3b93f0710 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -1402,6 +1402,34 @@ typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, | |||
| 1402 | unsigned int command_bits, u32 flags); | 1402 | unsigned int command_bits, u32 flags); |
| 1403 | void pci_register_set_vga_state(arch_set_vga_state_t func); | 1403 | void pci_register_set_vga_state(arch_set_vga_state_t func); |
| 1404 | 1404 | ||
| 1405 | static inline int | ||
| 1406 | pci_request_io_regions(struct pci_dev *pdev, const char *name) | ||
| 1407 | { | ||
| 1408 | return pci_request_selected_regions(pdev, | ||
| 1409 | pci_select_bars(pdev, IORESOURCE_IO), name); | ||
| 1410 | } | ||
| 1411 | |||
| 1412 | static inline void | ||
| 1413 | pci_release_io_regions(struct pci_dev *pdev) | ||
| 1414 | { | ||
| 1415 | return pci_release_selected_regions(pdev, | ||
| 1416 | pci_select_bars(pdev, IORESOURCE_IO)); | ||
| 1417 | } | ||
| 1418 | |||
| 1419 | static inline int | ||
| 1420 | pci_request_mem_regions(struct pci_dev *pdev, const char *name) | ||
| 1421 | { | ||
| 1422 | return pci_request_selected_regions(pdev, | ||
| 1423 | pci_select_bars(pdev, IORESOURCE_MEM), name); | ||
| 1424 | } | ||
| 1425 | |||
| 1426 | static inline void | ||
| 1427 | pci_release_mem_regions(struct pci_dev *pdev) | ||
| 1428 | { | ||
| 1429 | return pci_release_selected_regions(pdev, | ||
| 1430 | pci_select_bars(pdev, IORESOURCE_MEM)); | ||
| 1431 | } | ||
| 1432 | |||
| 1405 | #else /* CONFIG_PCI is not enabled */ | 1433 | #else /* CONFIG_PCI is not enabled */ |
| 1406 | 1434 | ||
| 1407 | static inline void pci_set_flags(int flags) { } | 1435 | static inline void pci_set_flags(int flags) { } |
