PCI: acpiphp: remove all functions in slot, even without ACPI _EJx

When we add a device with acpiphp, we enumerate all functions in the
slot with pci_scan_slot(), regardless of whether they have associated
ACPI methods such as _EJ0.

When removing the device, we previously removed only the functions
with those ACPI methods.  This patch makes the remove symmetric with the
add: we remove all functions in the slot, whether they have associated
ACPI methods or not.

With qemu-kvm and SeaBIOS, we can build a multi-function device where
only function 0 has _EJ0 and _ADR (see bugzilla below).  Removing and
re-adding that slot (including all functions of the device) works correctly
with Windows guests.  This patch makes it also work in Linux guests.

[bhelgaas: restructure loop iteration, pull out of slot->funcs loop]
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=43219
Signed-off-by: Amos Kong <kongjianjun@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2 files changed