diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2009-10-05 04:46:43 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-11-04 12:02:35 -0500 |
commit | 8792e11f1c54bcba34412f03959e70ee217f2231 (patch) | |
tree | aa81ae55e49567231b7899b40beb72a64e470e00 /drivers/pci/hotplug | |
parent | 65b947bc5f32d8d4fe1f925a6146a4088d5466f3 (diff) |
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: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index e1b29a59032b..5674b2075bdc 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -253,14 +253,13 @@ static int pciehp_probe(struct pcie_device *dev) | |||
253 | int rc; | 253 | int rc; |
254 | struct controller *ctrl; | 254 | struct controller *ctrl; |
255 | struct slot *slot; | 255 | struct slot *slot; |
256 | u8 value; | 256 | u8 occupied, poweron; |
257 | struct pci_dev *pdev = dev->port; | ||
258 | 257 | ||
259 | if (pciehp_force) | 258 | if (pciehp_force) |
260 | dev_info(&dev->device, | 259 | dev_info(&dev->device, |
261 | "Bypassing BIOS check for pciehp use on %s\n", | 260 | "Bypassing BIOS check for pciehp use on %s\n", |
262 | pci_name(pdev)); | 261 | pci_name(dev->port)); |
263 | else if (pciehp_get_hp_hw_control_from_firmware(pdev)) | 262 | else if (pciehp_get_hp_hw_control_from_firmware(dev->port)) |
264 | goto err_out_none; | 263 | goto err_out_none; |
265 | 264 | ||
266 | ctrl = pcie_init(dev); | 265 | ctrl = pcie_init(dev); |
@@ -290,18 +289,13 @@ static int pciehp_probe(struct pcie_device *dev) | |||
290 | 289 | ||
291 | /* Check if slot is occupied */ | 290 | /* Check if slot is occupied */ |
292 | slot = ctrl->slot; | 291 | slot = ctrl->slot; |
293 | pciehp_get_adapter_status(slot, &value); | 292 | pciehp_get_adapter_status(slot, &occupied); |
294 | if (value) { | 293 | pciehp_get_power_status(slot, &poweron); |
295 | if (pciehp_force) | 294 | if (occupied && pciehp_force) |
296 | pciehp_enable_slot(slot); | 295 | pciehp_enable_slot(slot); |
297 | } else { | 296 | /* If empty slot's power status is on, turn power off */ |
298 | /* Power off slot if not occupied */ | 297 | if (!occupied && poweron && POWER_CTRL(ctrl)) |
299 | if (POWER_CTRL(ctrl)) { | 298 | pciehp_power_off_slot(slot); |
300 | rc = pciehp_power_off_slot(slot); | ||
301 | if (rc) | ||
302 | goto err_out_free_ctrl_slot; | ||
303 | } | ||
304 | } | ||
305 | 299 | ||
306 | return 0; | 300 | return 0; |
307 | 301 | ||