All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>, <linux-pci@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] PCI: Use reverse logic in pci_read_bridge_bases()
Date: Fri, 18 Oct 2024 17:07:33 +0100	[thread overview]
Message-ID: <20241018170733.00007fe7@Huawei.com> (raw)
In-Reply-To: <20241017141111.44612-3-ilpo.jarvinen@linux.intel.com>

On Thu, 17 Oct 2024 17:11:10 +0300
Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:

> 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>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.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);
>  	}
>  }
>  


  reply	other threads:[~2024-10-18 16:08 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 ` [PATCH 3/3] PCI: Use reverse logic in pci_read_bridge_bases() Ilpo Järvinen
2024-10-18 16:07   ` Jonathan Cameron [this message]
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=20241018170733.00007fe7@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=ilpo.jarvinen@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.