usb: xhci: Avoid showing errors during surprise removal
Subsystems (3)
PATCH 3/4 usb: xhci: Avoid showing errors during surprise removal
From: Mario Limonciello <[email protected]>
When a USB4 dock is unplugged from a system it won't respond to ring events. The PCI core handles the surprise removal event and notifies all PCI drivers. The XHCI PCI driver sets a flag that the device is being removed as well.
When that flag is set don't show messages in the cleanup path for marking the controller dead.
--- drivers/usb/host/xhci-ring.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-ring.c +5 -2
@@ -1377,12 +1377,15 @@ static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci,*/ void xhci_hc_died (struct xhci_hcd *xhci) { +bool notify;int i, j;if (xhci->xhc_state &XHCI_STATE_DYING )return ; -xhci_err (xhci,"xHCI host controller not responding, assume dead\n" ); + notify = !(xhci->xhc_state &XHCI_STATE_REMOVING ); +if (notify) +xhci_err (xhci,"xHCI host controller not responding, assume dead\n" ); xhci->xhc_state |=XHCI_STATE_DYING ;xhci_cleanup_command_queue (xhci);
@@ -1396,7 +1399,7 @@ void xhci_hc_died(struct xhci_hcd *xhci) }/* inform usb core hc died if PCI remove isn't already handling it */ -if (!(xhci->xhc_state &XHCI_STATE_REMOVING )) +if (notify)usb_hc_died (xhci_to_hcd (xhci)); }
Signature · 1 line
2.43.0
PATCH 4/4 usb: xhci: Avoid showing warnings for dying controller
From: Mario Limonciello <[email protected]>
When a USB4 dock is unplugged from a system it won't respond to ring events. The PCI core handles the surprise removal event and notifies all PCI drivers. The XHCI PCI driver sets a flag that the device is being removed, and when the device stops responding a flag is also added to indicate it's dying.
When that flag is set don't bother to show warnings about a missing controller.
--- drivers/usb/host/xhci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +4 -2
@@ -144,7 +144,8 @@ int xhci_halt(struct xhci_hcd *xhci) ret =xhci_handshake (&xhci->op_regs->status,STS_HALT ,STS_HALT ,XHCI_MAX_HALT_USEC );if (ret) { -xhci_warn (xhci,"Host halt failed, %d\n" , ret); +if (!(xhci->xhc_state &XHCI_STATE_DYING )) +xhci_warn (xhci,"Host halt failed, %d\n" , ret);return ret; }
@@ -203,7 +204,8 @@ int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us) state =readl (&xhci->op_regs->status);if (state == ~(u32 )0 ) { -xhci_warn (xhci,"Host not accessible, reset failed.\n" ); +if (!(xhci->xhc_state &XHCI_STATE_DYING )) +xhci_warn (xhci,"Host not accessible, reset failed.\n" );return -ENODEV ; }
Signature · 1 line
2.43.0