public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH 3/3] PCI: Use reverse logic in pci_read_bridge_bases()
Date: Thu, 17 Oct 2024 17:11:10 +0300	[thread overview]
Message-ID: <20241017141111.44612-3-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20241017141111.44612-1-ilpo.jarvinen@linux.intel.com>

Use reverse logic combined with return and continue to allow
significant reduction in indentation level in pci_read_bridge_bases().

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/probe.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4243b1e6ece2..cc97dbda7e76 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -543,14 +543,15 @@ void pci_read_bridge_bases(struct pci_bus *child)
 	pci_read_bridge_mmio(child->self, child->resource[1], false);
 	pci_read_bridge_mmio_pref(child->self, child->resource[2], false);
 
-	if (dev->transparent) {
-		pci_bus_for_each_resource(child->parent, res) {
-			if (res && res->flags) {
-				pci_bus_add_resource(child, res);
-				pci_info(dev, "  bridge window %pR (subtractive decode)\n",
-					   res);
-			}
-		}
+	if (!dev->transparent)
+		return;
+
+	pci_bus_for_each_resource(child->parent, res) {
+		if (!res || !res->flags)
+			continue;
+
+		pci_bus_add_resource(child, res);
+		pci_info(dev, "  bridge window %pR (subtractive decode)\n", res);
 	}
 }
 
-- 
2.39.5


  parent reply	other threads:[~2024-10-17 14:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 14:11 [PATCH 1/3] PCI: Remove unused PCI_SUBTRACTIVE_DECODE Ilpo Järvinen
2024-10-17 14:11 ` [PATCH 2/3] PCI: Move struct pci_bus_resource into bus.c Ilpo Järvinen
2024-10-18 16:00   ` Jonathan Cameron
2024-10-17 14:11 ` Ilpo Järvinen [this message]
2024-10-18 16:07   ` [PATCH 3/3] PCI: Use reverse logic in pci_read_bridge_bases() Jonathan Cameron
2024-10-18 15:58 ` [PATCH 1/3] PCI: Remove unused PCI_SUBTRACTIVE_DECODE Jonathan Cameron
2024-10-18 18:36 ` Bjorn Helgaas

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=20241017141111.44612-3-ilpo.jarvinen@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.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