[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 1/4] PCI: Introduce pci_dev_for_each_resource()
- To: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
- From: Keith Busch <kbusch@xxxxxxxxxx>
- Date: Fri, 10 Mar 2023 15:15:38 -0700
- Cc: Mickaël Salaün <mic@xxxxxxxxxxx>, Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>, Krzysztof Wilczyński <kw@xxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Randy Dunlap <rdunlap@xxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Bjorn Helgaas <helgaas@xxxxxxxxxx>, "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>, Niklas Schnelle <schnelle@xxxxxxxxxxxxx>, 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, 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: Fri, 10 Mar 2023 22:15:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Fri, Mar 10, 2023 at 07:14:13PM +0200, Andy Shevchenko wrote:
> +#define __pci_dev_for_each_resource(dev, res, __i, vartype) \
> + for (vartype __i = 0; \
> + res = &(dev)->resource[__i], __i < PCI_NUM_RESOURCES; \
> + __i++)
...
> +#define pci_dev_for_each_resource_p(dev, res)
> \
> + __pci_dev_for_each_resource(dev, res, i, unsigned int)
It looks dangerous to have a macro declare a variable when starting a new
scope. How do you know the name 'i' won't clash with something defined above?
|