Commit 144d204d authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Bjorn Helgaas

PCI: Introduce pci_resource_n()

Introduce pci_resource_n() and replace open-coded implementations of it
in pci.h.

Link: https://lore.kernel.org/r/20230330162434.35055-3-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
parent fe15c26e
...@@ -1994,14 +1994,13 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma); ...@@ -1994,14 +1994,13 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma);
* These helpers provide future and backwards compatibility * These helpers provide future and backwards compatibility
* for accessing popular PCI BAR info * for accessing popular PCI BAR info
*/ */
#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) #define pci_resource_n(dev, bar) (&(dev)->resource[(bar)])
#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) #define pci_resource_start(dev, bar) (pci_resource_n(dev, bar)->start)
#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) #define pci_resource_end(dev, bar) (pci_resource_n(dev, bar)->end)
#define pci_resource_len(dev,bar) \ #define pci_resource_flags(dev, bar) (pci_resource_n(dev, bar)->flags)
((pci_resource_end((dev), (bar)) == 0) ? 0 : \ #define pci_resource_len(dev,bar) \
\ (pci_resource_end((dev), (bar)) ? \
(pci_resource_end((dev), (bar)) - \ resource_size(pci_resource_n((dev), (bar))) : 0)
pci_resource_start((dev), (bar)) + 1))
/* /*
* Similar to the helpers above, these manipulate per-pci_dev * Similar to the helpers above, these manipulate per-pci_dev
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment