Here's my proposal for fixing this problem.
I split out the pci_dev_put() for function 0 because it looks to me
like that is actually a separate issue -- it looks like we leaked
that reference even for single-function devices.
I restructured the iteration over bus->devices to make it read a bit
more naturally, and also to remove it from inside the slot->funcs
loop. It didn't make sense to me to have a nested loop there.
The cleanup_p2p_bridge() stuff is mostly just fiddling with notify
handlers and other ACPI-specific stuff. I don't think there's
actually a dependency there on the PCI device removal, so I think
it's safe to do that separately.
Does this make sense to you? If so, can you test it and make sure
it actually works?
Thanks,
Bjorn
---
Amos Kong (2):
PCI: acpiphp: fix function 0 leak when disabling a slot
PCI: acpiphp: remove all functions in slot, even without ACPI _EJx
drivers/pci/hotplug/acpiphp_glue.c | 40 +++++++++++++++++++++++++++---------
1 files changed, 30 insertions(+), 10 deletions(-)