[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 6/6] PCI: Make use of pci_resource_n()
- To: Mickaël Salaün <mic@xxxxxxxxxxx>, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>, Krzysztof Wilczyński <kw@xxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Randy Dunlap <rdunlap@xxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Niklas Schnelle <schnelle@xxxxxxxxxxxxx>, Bjorn Helgaas <helgaas@xxxxxxxxxx>, "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>, Pali Rohár <pali@xxxxxxxxxx>, "Maciej W. Rozycki" <macro@xxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx
- From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
- Date: Thu, 23 Mar 2023 19:36:10 +0200
- Cc: Miguel Ojeda <ojeda@xxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Ivan Kokshaysky <ink@xxxxxxxxxxxxxxxxxxxx>, Matt Turner <mattst88@xxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Andrew Lunn <andrew@xxxxxxx>, Sebastian Hesselbarth <sebastian.hesselbarth@xxxxxxxxx>, Gregory Clement <gregory.clement@xxxxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Nicholas Piggin <npiggin@xxxxxxxxx>, Christophe Leroy <christophe.leroy@xxxxxxxxxx>, Anatolij Gustschin <agust@xxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, Rich Felker <dalias@xxxxxxxx>, John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
- Delivery-date: Thu, 23 Mar 2023 17:36:03 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Replace open-coded implementations of pci_resource_n() in pci.h.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
include/linux/pci.h | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 70a4684d5f26..9539cf63fe5e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -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; \
--
2.40.0.1.gaa8946217a0b
|