diff options
author | Lukas Wunner <lukas@wunner.de> | 2018-07-20 00:27:40 +0200 |
---|---|---|
committer | Bjorn Helgaas <helgaas@kernel.org> | 2018-07-24 00:04:12 +0200 |
commit | b0ccd9dd5dc8bf348112bb97e4f7eef6be5cf469 (patch) | |
tree | 934786a14779cfd8fca9e32394f2979d50ad9166 /drivers/pci/hotplug/pciehp_core.c | |
parent | PCI: pciehp: Convert to threaded polling (diff) | |
download | linux-b0ccd9dd5dc8bf348112bb97e4f7eef6be5cf469.tar.xz linux-b0ccd9dd5dc8bf348112bb97e4f7eef6be5cf469.zip |
PCI: pciehp: Stop blinking on slot enable failure
If the attention button is pressed to power on the slot AND the user
powers on the slot via sysfs before 5 seconds have elapsed AND powering
on the slot fails because either the slot is unoccupied OR the latch is
open, we neglect turning off the green LED so it keeps on blinking.
That's because the error path of pciehp_sysfs_enable_slot() doesn't call
pciehp_green_led_off(), unlike pciehp_power_thread() which does.
The bug has been present since 2004 when the driver was introduced.
Fix by deduplicating common code in pciehp_sysfs_enable_slot() and
pciehp_power_thread() into a wrapper function pciehp_enable_slot() and
renaming the existing function to __pciehp_enable_slot(). Same for
pciehp_disable_slot(). This will also simplify the upcoming rework of
pciehp's event handling.
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/hotplug/pciehp_core.c')
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 2ba59fc94827..8a2133856dfd 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -248,11 +248,8 @@ static int pciehp_probe(struct pcie_device *dev) slot = ctrl->slot; pciehp_get_adapter_status(slot, &occupied); pciehp_get_power_status(slot, &poweron); - if (occupied && pciehp_force) { - mutex_lock(&slot->hotplug_lock); + if (occupied && pciehp_force) pciehp_enable_slot(slot); - mutex_unlock(&slot->hotplug_lock); - } /* If empty slot's power status is on, turn power off */ if (!occupied && poweron && POWER_CTRL(ctrl)) pciehp_power_off_slot(slot); @@ -296,12 +293,10 @@ static int pciehp_resume(struct pcie_device *dev) /* Check if slot is occupied */ pciehp_get_adapter_status(slot, &status); - mutex_lock(&slot->hotplug_lock); if (status) pciehp_enable_slot(slot); else pciehp_disable_slot(slot); - mutex_unlock(&slot->hotplug_lock); return 0; } #endif /* PM */ |