From: Dominik Brodowski 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 Message-ID: References: <20221103164644.70554-1-andriy.shevchenko@linux.intel.com> <20221103164644.70554-5-andriy.shevchenko@linux.intel.com> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <20221103164644.70554-5-andriy.shevchenko@linux.intel.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane-mx.org@lists.ozlabs.org Sender: "Linuxppc-dev" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Andy Shevchenko Cc: linux-pci@vger.kernel.org, linux-mips@vger.kernel.org, Bjorn Helgaas , sparclinux@vger.kernel.org, Stefano Stabellini , "Rafael J. Wysocki" , Russell King , Bjorn Helgaas , Miguel Ojeda , xen-devel@lists.xenproject.org, Matt Turner , Arnd Bergmann , Richard Henderson , Nicholas Piggin , Ivan Kokshaysky , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , Mika Westerberg , linux-arm-kernel@lists.infradead.org, Juergen Gross , Thomas Bogendoerfer , linux-kernel@vger.ke, rnel.org, Oleksandr Tyshchenko , linux-alpha@vger.kernel.org, linux 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