]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.166/usb-core-fix-hub-port-connection-events-lost.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 4.4.166 / usb-core-fix-hub-port-connection-events-lost.patch
CommitLineData
9a7cb72c
GKH
1From 22454b79e6de05fa61a2a72d00d2eed798abbb75 Mon Sep 17 00:00:00 2001
2From: Dennis Wassenberg <dennis.wassenberg@secunet.com>
3Date: Tue, 13 Nov 2018 14:40:34 +0100
4Subject: usb: core: Fix hub port connection events lost
5
6From: Dennis Wassenberg <dennis.wassenberg@secunet.com>
7
8commit 22454b79e6de05fa61a2a72d00d2eed798abbb75 upstream.
9
10This will clear the USB_PORT_FEAT_C_CONNECTION bit in case of a hub port reset
11only if a device is was attached to the hub port before resetting the hub port.
12
13Using a Lenovo T480s attached to the ultra dock it was not possible to detect
14some usb-c devices at the dock usb-c ports because the hub_port_reset code
15will clear the USB_PORT_FEAT_C_CONNECTION bit after the actual hub port reset.
16Using this device combo the USB_PORT_FEAT_C_CONNECTION bit was set between the
17actual hub port reset and the clear of the USB_PORT_FEAT_C_CONNECTION bit.
18This ends up with clearing the USB_PORT_FEAT_C_CONNECTION bit after the
19new device was attached such that it was not detected.
20
21This patch will not clear the USB_PORT_FEAT_C_CONNECTION bit if there is
22currently no device attached to the port before the hub port reset.
23This will avoid clearing the connection bit for new attached devices.
24
25Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
26Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
27Cc: stable <stable@vger.kernel.org>
28Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30---
31 drivers/usb/core/hub.c | 4 +++-
32 1 file changed, 3 insertions(+), 1 deletion(-)
33
34--- a/drivers/usb/core/hub.c
35+++ b/drivers/usb/core/hub.c
36@@ -2757,7 +2757,9 @@ static int hub_port_reset(struct usb_hub
37 USB_PORT_FEAT_C_BH_PORT_RESET);
38 usb_clear_port_feature(hub->hdev, port1,
39 USB_PORT_FEAT_C_PORT_LINK_STATE);
40- usb_clear_port_feature(hub->hdev, port1,
41+
42+ if (udev)
43+ usb_clear_port_feature(hub->hdev, port1,
44 USB_PORT_FEAT_C_CONNECTION);
45
46 /*