@@ -2006,14 +2006,12 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma);
* for accessing popular PCI BAR info
*/
#define pci_resource_n(dev, bar) (&(dev)->resource[(bar)])
-#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
-#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
-#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags)
-#define pci_resource_len(dev,bar) \
- ((pci_resource_end((dev), (bar)) == 0) ? 0 : \
- \
- (pci_resource_end((dev), (bar)) - \
- pci_resource_start((dev), (bar)) + 1))
+#define pci_resource_start(dev, bar) (pci_resource_n(dev, bar)->start)
+#define pci_resource_end(dev, bar) (pci_resource_n(dev, bar)->end)
+#define pci_resource_flags(dev, bar) (pci_resource_n(dev, bar)->flags)
+#define pci_resource_len(dev,bar) \
+ (pci_resource_end((dev), (bar)) ? \
+ resource_size(pci_resource_n((dev), (bar))) : 0)
#define __pci_dev_for_each_resource_0(dev, res, ...) \
for (unsigned int __b = 0; \
Replace open-coded implementations of pci_resource_n() in pci.h. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- include/linux/pci.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)