]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/xhci-don-t-print-a-warning-when-setting-link-state-for-disabled-ports.patch
Linux 4.9.135
[thirdparty/kernel/stable-queue.git] / queue-4.4 / xhci-don-t-print-a-warning-when-setting-link-state-for-disabled-ports.patch
1 From 1208d8a84fdcae6b395c57911cdf907450d30e70 Mon Sep 17 00:00:00 2001
2 From: Mathias Nyman <mathias.nyman@linux.intel.com>
3 Date: Mon, 12 Feb 2018 14:24:47 +0200
4 Subject: xhci: Don't print a warning when setting link state for disabled ports
5
6 From: Mathias Nyman <mathias.nyman@linux.intel.com>
7
8 commit 1208d8a84fdcae6b395c57911cdf907450d30e70 upstream.
9
10 When disabling a USB3 port the hub driver will set the port link state to
11 U3 to prevent "ejected" or "safely removed" devices that are still
12 physically connected from immediately re-enumerating.
13
14 If the device was really unplugged, then error messages were printed
15 as the hub tries to set the U3 link state for a port that is no longer
16 enabled.
17
18 xhci-hcd ee000000.usb: Cannot set link state.
19 usb usb8-port1: cannot disable (err = -32)
20
21 Don't print error message in xhci-hub if hub tries to set port link state
22 for a disabled port. Return -ENODEV instead which also silences hub driver.
23
24 Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
25 Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
26 Signed-off-by: Ross Zwisler <zwisler@google.com>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28
29 ---
30 drivers/usb/host/xhci-hub.c | 18 +++++++++---------
31 1 file changed, 9 insertions(+), 9 deletions(-)
32
33 --- a/drivers/usb/host/xhci-hub.c
34 +++ b/drivers/usb/host/xhci-hub.c
35 @@ -1048,17 +1048,17 @@ int xhci_hub_control(struct usb_hcd *hcd
36 temp = readl(port_array[wIndex]);
37 break;
38 }
39 -
40 - /* Software should not attempt to set
41 - * port link state above '3' (U3) and the port
42 - * must be enabled.
43 - */
44 - if ((temp & PORT_PE) == 0 ||
45 - (link_state > USB_SS_PORT_LS_U3)) {
46 - xhci_warn(xhci, "Cannot set link state.\n");
47 + /* Port must be enabled */
48 + if (!(temp & PORT_PE)) {
49 + retval = -ENODEV;
50 + break;
51 + }
52 + /* Can't set port link state above '3' (U3) */
53 + if (link_state > USB_SS_PORT_LS_U3) {
54 + xhci_warn(xhci, "Cannot set port %d link state %d\n",
55 + wIndex, link_state);
56 goto error;
57 }
58 -
59 if (link_state == USB_SS_PORT_LS_U3) {
60 slot_id = xhci_find_slot_id_by_port(hcd, xhci,
61 wIndex + 1);