Skip to contentSkip to conversation

PCI: pciehp: Fix the slot in BLINKINGON_STATE when Presence Detect Changed event occurred

PATCH Superseded Rongguang Wei 1 participant 1 message Apr 21, 2023 PCI

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PCI: pciehp: Fix the slot in BLINKINGON_STATE when Presence Detect Changed event occurred

From: Rongguang Wei <[email protected]>

pciehp's behavior is incorrect if the Attention Button is pressed on an unoccupied slot.

When a Presence Detect Changed event has occurred, the slot status in either BLINKINGOFF_STATE or OFF_STATE, turn it off unconditionally. But if the slot status is in BLINKINGON_STATE and the slot is currently empty, the slot status was staying in BLINKINGON_STATE.

The message print like this:

    pcieport 0000:00:01.5: pciehp: Slot(0-5): Attention button pressed
    pcieport 0000:00:01.5: pciehp: Slot(0-5) Powering on due to button press
    pcieport 0000:00:01.5: pciehp: Slot(0-5): Attention button pressed
    pcieport 0000:00:01.5: pciehp: Slot(0-5): Button cancel
    pcieport 0000:00:01.5: pciehp: Slot(0-5): Action canceled due to button press

It cause the next Attention Button Pressed event become Button cancel and missing the Presence Detect Changed event with this button press though this button presses event is occurred after 5s.

According to the Commit d331710ea78f ("PCI: pciehp: Become resilient to missed events"), if the slot is currently occupied, turn it on and if the slot is empty, it need to set in OFF_STATE rather than stay in current status when pciehp_handle_presence_or_link_change() bails out.

V2: Update to simple code and avoid gratuitous message.

Fixes d331710ea78f ("PCI: pciehp: Become resilient to missed events")
---
 drivers/pci/hotplug/pciehp_ctrl.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/hotplug/pciehp_ctrl.c +1 -0
index 529c34808440..1f78e401e9b6 100644
@@ -256,6 +256,7 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
 	present = pciehp_card_present(ctrl);
 	link_active = pciehp_check_link_active(ctrl);
 	if (present <= 0 && link_active <= 0) {
+		ctrl->state = OFF_STATE;
 		mutex_unlock(&ctrl->state_lock);
 		return;
 	}
Signature · 5 lines
2.25.1


No virus found
		Checked by Hillstone Network AntiVirus