Skip to content

Commit

Permalink
PCI: acpiphp: Remove all functions even if function 0 doesn't exist
Browse files Browse the repository at this point in the history
Currently function disable_device() detects slot state by checking
existence of PCI function 0.  It's unreliable because the PCI device
for function 0 may be removed through the sysfs interface.  If that
happens, it will cause powering off a hotplug slot without destroying
all PCI devices.

On the other hand, it won't hurt us except wasting some computation
power if the check is removed, because all code of disable_device()
is self-protected.  So remove the check.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Toshi Kani <toshi.kani@hp.com>
  • Loading branch information
Jiang Liu authored and Bjorn Helgaas committed Apr 12, 2013
1 parent d65eba6 commit 3a0e40b
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions drivers/pci/hotplug/acpiphp_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,13 +914,6 @@ static int disable_device(struct acpiphp_slot *slot)
struct pci_dev *pdev;
struct pci_bus *bus = slot->bridge->pci_bus;

/* The slot will be enabled when func 0 is added, so check
func 0 before disable the slot. */
pdev = pci_get_slot(bus, PCI_DEVFN(slot->device, 0));
if (!pdev)
goto err_exit;
pci_dev_put(pdev);

list_for_each_entry(func, &slot->funcs, sibling) {
if (func->bridge) {
/* cleanup p2p bridges under this P2P bridge */
Expand Down

0 comments on commit 3a0e40b

Please sign in to comment.