Commit 8792e11f authored by Kenji Kaneshige's avatar Kenji Kaneshige Committed by Jesse Barnes

PCI: pciehp: prevent unnecessary power off

Prevent unnecessary power off at initialization time. If slot power
is already off, we don't need to power off the slot.
Signed-off-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 65b947bc
...@@ -253,14 +253,13 @@ static int pciehp_probe(struct pcie_device *dev) ...@@ -253,14 +253,13 @@ static int pciehp_probe(struct pcie_device *dev)
int rc; int rc;
struct controller *ctrl; struct controller *ctrl;
struct slot *slot; struct slot *slot;
u8 value; u8 occupied, poweron;
struct pci_dev *pdev = dev->port;
if (pciehp_force) if (pciehp_force)
dev_info(&dev->device, dev_info(&dev->device,
"Bypassing BIOS check for pciehp use on %s\n", "Bypassing BIOS check for pciehp use on %s\n",
pci_name(pdev)); pci_name(dev->port));
else if (pciehp_get_hp_hw_control_from_firmware(pdev)) else if (pciehp_get_hp_hw_control_from_firmware(dev->port))
goto err_out_none; goto err_out_none;
ctrl = pcie_init(dev); ctrl = pcie_init(dev);
...@@ -290,18 +289,13 @@ static int pciehp_probe(struct pcie_device *dev) ...@@ -290,18 +289,13 @@ static int pciehp_probe(struct pcie_device *dev)
/* Check if slot is occupied */ /* Check if slot is occupied */
slot = ctrl->slot; slot = ctrl->slot;
pciehp_get_adapter_status(slot, &value); pciehp_get_adapter_status(slot, &occupied);
if (value) { pciehp_get_power_status(slot, &poweron);
if (pciehp_force) if (occupied && pciehp_force)
pciehp_enable_slot(slot); pciehp_enable_slot(slot);
} else { /* If empty slot's power status is on, turn power off */
/* Power off slot if not occupied */ if (!occupied && poweron && POWER_CTRL(ctrl))
if (POWER_CTRL(ctrl)) { pciehp_power_off_slot(slot);
rc = pciehp_power_off_slot(slot);
if (rc)
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