public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Yicong Yang <yangyicong@hisilicon.com>
Cc: linux-pci@vger.kernel.org, kvalo@codeaurora.org,
	andreas.noever@gmail.com, rjw@rjwysocki.net,
	linux-wireless@vger.kernel.org, linux-usb@vger.kernel.org,
	mika.westerberg@linux.intel.com, linuxarm@huawei.com
Subject: Re: [PATCH v2] PCI: Use pci_pcie_find_root_port() to get root port
Date: Fri, 8 May 2020 11:07:12 -0500	[thread overview]
Message-ID: <20200508160712.GA75354@bjorn-Precision-5520> (raw)
In-Reply-To: <3a5ccd55-5aac-ef16-6402-75dfaeaee6bf@hisilicon.com>

On Fri, May 08, 2020 at 08:40:49PM +0800, Yicong Yang wrote:
> On 2020/5/7 3:48, Bjorn Helgaas wrote:
> > On Wed, May 06, 2020 at 08:42:56PM +0800, Yicong Yang wrote:

> >>  {
> >> -	while (1) {
> >> -		if (!pci_is_pcie(dev))
> >> -			break;
> >> +	dev = pci_physfn(dev);
> >> +	while (dev) {
> >>  		if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
> >>  			return dev;
> >> -		if (!dev->bus->self)
> >> -			break;
> >>  		dev = dev->bus->self;
> > Why not use pci_upstream_bridge() here?
> 
> We'll judge whether the device is virtual or not every time we call
> pci_upstream_bridge(). I think it's unnecessary and we only need to get
> the physical function at the beginning of the traverse. It's okay to
> use pci_upstream_bridge() here if you suggest so.

I think we should use pci_upstream_bridge() consistently.  Using two
different patterns is confusing and error-prone.

Bjorn

      reply	other threads:[~2020-05-08 16:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06 12:42 [PATCH v2] PCI: Use pci_pcie_find_root_port() to get root port Yicong Yang
2020-05-06 19:48 ` Bjorn Helgaas
2020-05-08 12:40   ` Yicong Yang
2020-05-08 16:07     ` Bjorn Helgaas [this message]

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=20200508160712.GA75354@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=andreas.noever@gmail.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=yangyicong@hisilicon.com \
    /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