diff options
-rw-r--r-- | include/linux/pci.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 7e9a1f0715e6..46ad282ffe4d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -1119,5 +1119,18 @@ static inline void pci_mmcfg_early_init(void) { } | |||
1119 | static inline void pci_mmcfg_late_init(void) { } | 1119 | static inline void pci_mmcfg_late_init(void) { } |
1120 | #endif | 1120 | #endif |
1121 | 1121 | ||
1122 | static inline void * pci_ioremap_bar(struct pci_dev *pdev, int bar) | ||
1123 | { | ||
1124 | /* | ||
1125 | * Make sure the BAR is actually a memory resource, not an IO resource | ||
1126 | */ | ||
1127 | if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { | ||
1128 | WARN_ON(1); | ||
1129 | return NULL; | ||
1130 | } | ||
1131 | return ioremap_nocache(pci_resource_start(pdev, bar), | ||
1132 | pci_resource_len(pdev, bar)); | ||
1133 | } | ||
1134 | |||
1122 | #endif /* __KERNEL__ */ | 1135 | #endif /* __KERNEL__ */ |
1123 | #endif /* LINUX_PCI_H */ | 1136 | #endif /* LINUX_PCI_H */ |