[PATCH 1/2] pci: Fix root port bus->self is NULL

Jiang Liu jiang.liu at linux.intel.com
Tue Jan 7 19:54:14 EST 2014



On 2014/1/7 16:27, Yijing Wang wrote:
> On 2014/1/7 16:04, Dongsheng Wang wrote:
>> From: Wang Dongsheng <dongsheng.wang at freescale.com>
>>
>> the root port bus->self always NULL, so put root port pci device
>> into root port bus->self.
>>
>> Signed-off-by: Wang Dongsheng <dongsheng.wang at freescale.com>
>>
>> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
>> index 38e403d..7f2d1ab 100644
>> --- a/drivers/pci/probe.c
>> +++ b/drivers/pci/probe.c
>> @@ -1472,6 +1472,9 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
>>  	if (!dev->is_added)
>>  		nr++;
>>  
>> +	if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
>> +		bus->self = dev;
> 
> In this case, bus is the pci root bus I think, so why set bus->self = root port ?
> "bus->self" should pointer to the pci device that bridge out this bus.
Yes, this patch seems wrong. If dev is root port, bus should be root
bus, so we shouldn't set root_bus->self = pci_dev_of_root_port.

Actually PCI core has correctly setup pci_bus->self for secondary bus
of PCIe root port.

Thanks!
Gerry

> 
>> +
>>  	for (fn = next_fn(bus, dev, 0); fn > 0; fn = next_fn(bus, dev, fn)) {
>>  		dev = pci_scan_single_device(bus, devfn + fn);
>>  		if (dev) {
>>
> 
> 


More information about the Linuxppc-dev mailing list