• Yijing Wang's avatar
    PCI: pciehp: Iterate over all devices in slot, not functions 0-7 · ba518e3c
    Yijing Wang authored
    Currently, we enumerate devices in a slot with pci_scan_slot(), then
    iterate through all the devices we found by looking for functions 0-7.  But
    that's wrong for ARI devices, which may have function numbers up to 255.
    
    This means that when we hot-add an ARI device, pciehp only initializes
    functions 0-7, and other functions don't work correctly.  Additionally, if
    we hot-remove the device, pciehp only removes functions 0-7, leaving stale
    pci_dev structures for any other functions.
    
    This patch fixes the problem by iterating over devices in a slot by using
    the upstream bridge's "bus->devices" list instead.
    
    [bhelgaas: changelog]
    Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    ba518e3c
pciehp_pci.c 3.38 KB