Thread (14 messages) 14 messages, 3 authors, 2023-03-30

Re: [PATCH v7 6/6] PCI: Make use of pci_resource_n()

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2023-03-24 09:22:03
Also in: linux-acpi, linux-alpha, linux-arm-kernel, linux-mips, linux-pci, linux-sh, lkml, sparclinux, xen-devel

On Fri, Mar 24, 2023 at 10:08:39AM +0100, Philippe Mathieu-Daudé wrote:
On 23/3/23 18:36, Andy Shevchenko wrote:
quoted
Replace open-coded implementations of pci_resource_n() in pci.h.
...
quoted
  #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)
Seems (to me) more logical to have this patch as "PCI: Introduce
pci_resource_n()" ordered before your patch #2 "PCI: Introduce
pci_dev_for_each_resource()".
Either way works for me. Bjorn, what do you like?
Here as #6 or as #2:
Reviewed-by: Philippe Mathieu-Daudé <redacted>
Thank you!

-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help