usbcore: don't log on consecutive debounce failures of the same port
authorOliver Neukum <oneukum@suse.de>
Mon, 14 Jul 2014 13:39:49 +0000 (15:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Jul 2014 23:18:10 +0000 (16:18 -0700)
Some laptops have an internal port for a BT device which picks
up noise when the kill switch is used, but not enough to trigger
printk_rlimit(). So we shouldn't log consecutive faults of this kind.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hub.c

index 88f1db27e0af2768c87cbffbde35aab373e15bac..2c2f67ec36ad3da3e41beaaf24d422990c4f7242 100644 (file)
@@ -4547,6 +4547,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
        struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
        struct usb_port *port_dev = hub->ports[port1 - 1];
        struct usb_device *udev = port_dev->child;
+       static int unreliable_port = -1;
 
        /* Disconnect any existing devices under this port */
        if (udev) {
@@ -4567,10 +4568,14 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
                                USB_PORT_STAT_C_ENABLE)) {
                status = hub_port_debounce_be_stable(hub, port1);
                if (status < 0) {
-                       if (status != -ENODEV && printk_ratelimit())
-                               dev_err(&port_dev->dev,
-                                               "connect-debounce failed\n");
+                       if (status != -ENODEV &&
+                               port1 != unreliable_port &&
+                               printk_ratelimit())
+                               dev_err(&udev->dev, "connect-debounce failed, port %d disabled\n",
+                                       port1);
+
                        portstatus &= ~USB_PORT_STAT_CONNECTION;
+                       unreliable_port = port1;
                } else {
                        portstatus = status;
                }