From: Dominik Brodowski <linux@dominikbrodowski.net>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Mickaël Salaün" <mic@digikod.net>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Arnd Bergmann" <arnd@arndb.de>,
"Bjorn Helgaas" <helgaas@kernel.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
"Juergen Gross" <jgross@suse.com>,
linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org,
linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org,
"Miguel Ojeda" <ojeda@kernel.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Ivan Kokshaysky" <ink@jurassic.park.msu.ru>,
"Matt Turner" <mattst88@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"David S. Miller" <davem@davemloft.net>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Oleksandr Tyshchenko" <oleksandr_tyshchenko@epam.com>
Subject: Re: [PATCH v2 4/4] pcmcia: Convert to use pci_bus_for_each_resource_p()
Date: Thu, 3 Nov 2022 18:03:24 +0100 [thread overview]
Message-ID: <Y2P0XCNJvTVuziO7@owl.dominikbrodowski.net> (raw)
In-Reply-To: <20221103164644.70554-5-andriy.shevchenko@linux.intel.com>
Am Thu, Nov 03, 2022 at 06:46:44PM +0200 schrieb Andy Shevchenko:
> The pci_bus_for_each_resource_p() hides the iterator loop since
> it may be not used otherwise. With this, we may drop that iterator
> variable definition.
Thanks for your patch!
> diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
> index ad1141fddb4c..9d92d4bb6239 100644
> --- a/drivers/pcmcia/rsrc_nonstatic.c
> +++ b/drivers/pcmcia/rsrc_nonstatic.c
> @@ -934,7 +934,7 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
> static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
> {
> struct resource *res;
> - int i, done = 0;
> + int done = 0;
>
> if (!s->cb_dev || !s->cb_dev->bus)
> return -ENODEV;
> @@ -960,12 +960,9 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
> */
> if (s->cb_dev->bus->number == 0)
> return -EINVAL;
> -
> - for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {
> - res = s->cb_dev->bus->resource[i];
> -#else
> - pci_bus_for_each_resource(s->cb_dev->bus, res, i) {
> #endif
> +
> + pci_bus_for_each_resource_p(s->cb_dev->bus, res) {
> if (!res)
> continue;
Doesn't this remove the proper iterator for X86? Even if that is the right
thing to do, it needs an explict explanation.
>
> diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
> index 3966a6ceb1ac..b200f2b99a7a 100644
> --- a/drivers/pcmcia/yenta_socket.c
> +++ b/drivers/pcmcia/yenta_socket.c
> @@ -673,9 +673,8 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
> u32 min)
> {
> struct resource *root;
> - int i;
>
> - pci_bus_for_each_resource(socket->dev->bus, root, i) {
> + pci_bus_for_each_resource_p(socket->dev->bus, root) {
> if (!root)
> continue;
>
That looks fine!
Thanks,
Dominik
next prev parent reply other threads:[~2022-11-03 17:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 16:46 [PATCH v2 0/4] PCI: Add pci_dev_for_each_resource() helper and refactor bus one Andy Shevchenko
2022-11-03 16:46 ` [PATCH v2 1/4] PCI: Introduce pci_dev_for_each_resource() Andy Shevchenko
2022-11-03 16:46 ` [PATCH v2 2/4] PCI: Split pci_bus_for_each_resource_p() out of pci_bus_for_each_resource() Andy Shevchenko
2022-11-03 16:46 ` [PATCH v2 3/4] EISA: Convert to use pci_bus_for_each_resource_p() Andy Shevchenko
2022-11-03 16:46 ` [PATCH v2 4/4] pcmcia: " Andy Shevchenko
2022-11-03 17:03 ` Dominik Brodowski [this message]
2022-11-03 17:12 ` Andy Shevchenko
2022-11-03 17:25 ` Dominik Brodowski
2022-11-03 18:01 ` Andy Shevchenko
2022-11-03 18:29 ` Krzysztof Wilczyński
2022-11-03 18:38 ` Dominik Brodowski
2022-11-03 19:01 ` Andy Shevchenko
2022-11-03 18:59 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y2P0XCNJvTVuziO7@owl.dominikbrodowski.net \
--to=linux@dominikbrodowski.net \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=christophe.leroy@csgroup.eu \
--cc=davem@davemloft.net \
--cc=helgaas@kernel.org \
--cc=ink@jurassic.park.msu.ru \
--cc=jgross@suse.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mattst88@gmail.com \
--cc=mic@digikod.net \
--cc=mika.westerberg@linux.intel.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ojeda@kernel.org \
--cc=oleksandr_tyshchenko@epam.com \
--cc=rafael.j.wysocki@intel.com \
--cc=richard.henderson@linaro.org \
--cc=sparclinux@vger.kernel.org \
--cc=sstabellini@kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®