From patchwork Mon Nov 14 18:58:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13042706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29FF6C433FE for ; Mon, 14 Nov 2022 18:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=paWI4d99mHYam+Pt6e36dNCF7jXtAX1NRi/v+Elxvq8=; b=MGRTtzFnBh0ZXA Txel5huoRl+CApT2CafOskBmqgSRK2x2vNVnZX041xhBTYqDvkCfOBSTIIx/i1H8C7WOcWSAW3Yxy sAg5Xj+mbprJ4eLiKOAySp+yx5XZMLAoJturH35vhNqyQyezeqOTJzoN3CqsB+M8zA3t8GudoRtsY SJ4FQDhEgu9K/SGLXYZohSp4lF2mN6XTY8yTwUuEIQzCnnMSW/dn5lJC+lJbB1CjecuL5gR12uiaL FtC5Z04Mmxhs9gLP7KufS/nRRAO49Pwdq21qUEdcKwM36CRsbesWHyPX+NPwi1+7Cd8pQKESKhdAM bwNm5JhI150h0N3Lt8aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouef7-003xyR-N5; Mon, 14 Nov 2022 18:58:29 +0000 Received: from mga18.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oueeq-003xqr-2H for linux-arm-kernel@lists.infradead.org; Mon, 14 Nov 2022 18:58:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668452292; x=1699988292; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BZMLhTwKqFLidxOVtwWq081cCaNo7ow4HF5ovB57GGE=; b=aPyQYIOGt3ALpsf7qnIz8dkBQX8iT6ykijN7i68DddUhjbbh6GKYyYHT RnKsmwjQzBor8bmmNs4W8aeslrLwqg5ycjeJNQuAwqzOifVyfCtwYZzUU 9+ue3guDRbbjM5+RqbnzBQdZocdW7rF5jmHJxAa8pcJSN9MbS4vmYs4tA HtCK4Cqazr4wQSQymKyM64wzEFZ2xZJX0AKQ6h3j61FtfXI5n6626vA3W LMWCY5nIpBIt1H3J8BcME5H9/0u7ND8xT+Wo21JWDnz4dbVEaiFcrR/2e rbvs/8Dho1LjQX0qyxPzdnv9haMN/ChZdDOgu+w3RRseYMPlALNg5z+5F w==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="295415997" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="295415997" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 10:58:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="638607286" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="638607286" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 14 Nov 2022 10:58:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id EECC2348; Mon, 14 Nov 2022 20:58:24 +0200 (EET) From: Andy Shevchenko To: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , Mika Westerberg , Andy Shevchenko , Michael Ellerman , Arnd Bergmann , Bjorn Helgaas , "Rafael J. Wysocki" , =?utf-8?q?Pali_Roh=C3=A1r?= , Juergen Gross , Dominik Brodowski , 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 Cc: 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: [PATCH v3 4/4] pcmcia: Convert to use pci_bus_for_each_resource_p() Date: Mon, 14 Nov 2022 20:58:22 +0200 Message-Id: <20221114185822.65038-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114185822.65038-1-andriy.shevchenko@linux.intel.com> References: <20221114185822.65038-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221114_105812_169839_1E78AD7D X-CRM114-Status: GOOD ( 17.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. Signed-off-by: Andy Shevchenko Acked-by: Dominik Brodowski --- drivers/pcmcia/rsrc_nonstatic.c | 9 +++------ drivers/pcmcia/yenta_socket.c | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) 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; 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;