Commit db9aaf0b authored by Kenji Kaneshige's avatar Kenji Kaneshige Committed by Jesse Barnes

PCI: pciehp: fix unexpected power off with pciehp_force

This patch fixes the problem that causes an occupied slot to be turned
off even if it has a working device.
Signed-off-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent b0b801dd
...@@ -432,18 +432,19 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ...@@ -432,18 +432,19 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
goto err_out_release_ctlr; goto err_out_release_ctlr;
} }
/* Check if slot is occupied */
t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset);
t_slot->hpc_ops->get_adapter_status(t_slot, &value);
t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ if (value) {
if (value && pciehp_force) { if (pciehp_force)
rc = pciehp_enable_slot(t_slot); pciehp_enable_slot(t_slot);
if (rc) /* -ENODEV: shouldn't happen, but deal with it */ } else {
value = 0; /* Power off slot if not occupied */
} if (POWER_CTRL(ctrl)) {
if ((POWER_CTRL(ctrl)) && !value) { rc = t_slot->hpc_ops->power_off_slot(t_slot);
rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ if (rc)
if (rc) goto err_out_free_ctrl_slot;
goto err_out_free_ctrl_slot; }
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment