On Wed, Apr 19, 2023 at 10:58:33AM +0800, Rongguang Wei wrote: > I test the 1-line change and it make the test failed. The dmesg like this: > > pcieport 0000:00:01.5: pciehp: Slot(0-5): Attention button pressed > pcieport 0000:00:01.5: pciehp: Slot(0-5): Powering off 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): Ignoring invalid state 0x4 [...] > diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c > index 529c34808440..462a61fc7313 100644 > --- a/drivers/pci/hotplug/pciehp_ctrl.c > +++ b/drivers/pci/hotplug/pciehp_ctrl.c > @@ -256,7 +256,9 @@ 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 = POWEROFF_STATE; > mutex_unlock(&ctrl->state_lock); My apologies, I made a mistake. I meant OFF_STATE, not POWEROFF_STATE. Could you try that, without the addition below: > + pciehp_disable_slot(ctrl, SURPRISE_REMOVAL); > return; > } Sorry again and thanks, Lukas