Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1917250rwi; Thu, 3 Nov 2022 10:27:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SM165eLMOw/9572s02heVCyTpj+EkOQ3Sra4It8/6Yw7ij1qrIXMGpnY4Spppycj0iBdn X-Received: by 2002:a17:907:782:b0:740:7120:c6e7 with SMTP id xd2-20020a170907078200b007407120c6e7mr29839245ejb.313.1667496463265; Thu, 03 Nov 2022 10:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667496463; cv=none; d=google.com; s=arc-20160816; b=zYHFBikBUgil5j14iswmml852mAszlHspO4l/8qy8VetA6yF7JlG+bUBNkZYSjNiYN PcEk808kefcBnRXwwxwjg7QxB7d5DmMYmMn3iTYQlPChz5rAn7okY+BgPTSO82JjXDSv x5uKNwmdOtE0N2Oc0dB1Nz+ZLYqOuNeMUW0u0jTIucYs0QGgx/BRNu6xQTC5TYFb7fTr 5tek+tnF1ogQvEbuwRPJnylqJCx7RYCXaoWbrtQs3clSeCAu5PGJqzdXJN3jil2PZY/W LOU+ETHAHYxBkIeE4ZA9E4Jb2S/0rJFZLrHGi2S+jQuHJTuxUv7R/IbTRGq+1L3hmvGF D5jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=pUAyI/G1e5efTxgcS4f3Sd0P5p+JoKT10cZRvvVJEbw=; b=Yq98OdZupvnts0wNQKXoKQp/mL/Xy4pXb9ITOT8yUdeSN3jZ4nu8Ve6t9H8Qnh+Ozl bRQPU/6wTn1z3x7jAKEVdSh/uAvYlKgCju6pwOqGEFMj4gW9uudjqr1M2zRM4FYof1Ar unzPcV/ZF5nCqKc26fRGdBahBYAl1bkSbRAS0HnoOpbcabJhltvcSTBi24gM7wEyh/wz 8ORpkfiVnXa/dMKnUYJPtv2AWgRUMMETyplImucZLgKnxRAbzXzx4rbJedqZWARu8C8w tr21jD1EwazWDAaPQCH8QWHvFphOgSExp+GRLNQTS3/IIX8RZMwyWzQXJ/8FMLx8Pt3K oduA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a1709065d1000b007ade14a74a7si1696593ejt.90.2022.11.03.10.27.20; Thu, 03 Nov 2022 10:27:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231697AbiKCRO0 (ORCPT + 97 others); Thu, 3 Nov 2022 13:14:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbiKCRNw (ORCPT ); Thu, 3 Nov 2022 13:13:52 -0400 X-Greylist: delayed 592 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 03 Nov 2022 10:13:29 PDT Received: from isilmar-4.linta.de (isilmar-4.linta.de [136.243.71.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F0311114; Thu, 3 Nov 2022 10:13:29 -0700 (PDT) X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id EACA0201349; Thu, 3 Nov 2022 17:03:34 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id 7BB42801C7; Thu, 3 Nov 2022 18:03:24 +0100 (CET) Date: Thu, 3 Nov 2022 18:03:24 +0100 From: Dominik Brodowski To: Andy Shevchenko Cc: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , Mika Westerberg , Michael Ellerman , Arnd Bergmann , Bjorn Helgaas , "Rafael J. Wysocki" , Juergen Gross , 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 , Richard Henderson , Ivan Kokshaysky , Matt Turner , Russell King , Thomas Bogendoerfer , Nicholas Piggin , Christophe Leroy , "David S. Miller" , Bjorn Helgaas , Stefano Stabellini , Oleksandr Tyshchenko Subject: Re: [PATCH v2 4/4] pcmcia: Convert to use pci_bus_for_each_resource_p() Message-ID: References: <20221103164644.70554-1-andriy.shevchenko@linux.intel.com> <20221103164644.70554-5-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221103164644.70554-5-andriy.shevchenko@linux.intel.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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