Re: [PATCH v2] PCI: Use pci_pcie_find_root_port() to get root port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux