diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2015-10-01 00:36:01 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-10-21 07:46:25 -0600 |
commit | 069155cbb44c1e9e45676ac64e3c95f76a8d5820 (patch) | |
tree | 4b65baa374c5bd285b4653deaf400e99aa017b2c /drivers/pci | |
parent | af67e7ce237fa0956168efca7909458d4ea93d4b (diff) |
dm: pci: Fix pci_last_busno() to return the real last bus no
Currently pci_last_busno() only checks the last bridge device
under the first UCLASS_PCI device. This is not the case when
there are multiple bridge devices.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci-uclass.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 2f4368fa1bf..d15de5ab37c 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -85,30 +85,7 @@ static int pci_get_bus_max(void) int pci_last_busno(void) { - struct pci_controller *hose; - struct udevice *bus; - struct uclass *uc; - int ret; - - debug("pci_last_busno\n"); - ret = uclass_get(UCLASS_PCI, &uc); - if (ret || list_empty(&uc->dev_head)) - return -1; - - /* Probe the last bus */ - bus = list_entry(uc->dev_head.prev, struct udevice, uclass_node); - debug("bus = %p, %s\n", bus, bus->name); - assert(bus); - ret = device_probe(bus); - if (ret) - return ret; - - /* If that bus has bridges, we may have new buses now. Get the last */ - bus = list_entry(uc->dev_head.prev, struct udevice, uclass_node); - hose = dev_get_uclass_priv(bus); - debug("bus = %s, hose = %p\n", bus->name, hose); - - return hose->last_busno; + return pci_get_bus_max(); } int pci_get_ff(enum pci_size_t size) |