Re: [PATCH] usbcore: don't log on consecutive debounce failures of the same port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 14, 2014 at 03:39:49PM +0200, oneukum@xxxxxxx wrote:
> From: Oliver Neukum <oneukum@xxxxxxx>
> 
> 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@xxxxxxx>
> ---
>  drivers/usb/core/hub.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 21b99b4..27597da 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -4531,6 +4531,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) {
> @@ -4551,10 +4552,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;

So if I have hubs with the same "broken" port, I'll only get one
message?  What if I have 2 "broken" ports, I'll keep getting the
messages?

I'm not suggesting that we have a "broken port" flag per port for each
hub, but this really seems like it is just a half-fix for a specific
piece of broken hardware :(

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux