RE: [PATCH] usb: Skip U1/U2 LPM disable if device is disconnected.

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

 



On Fri, 10 Jan 2014, Venkatesh Murthy, HemanthX wrote:

> Yes agree, but I think the multiple loops can be avoided. With the
> below change in hub_port_wait_reset around 5 secs is saved for
> disconnect detection.
> 
> @@ -2545,15 +2546,15 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
>                         port1, warm ? "warm " : "", delay);
>         }
> 
> -       if ((portstatus & USB_PORT_STAT_RESET))
> -               return -EBUSY;
> +       /* Device went away? */
> +       if (!(portstatus & USB_PORT_STAT_CONNECTION))
> +               return -ENOTCONN;

I don't think this is appropriate.  If USB_PORT_STAT_RESET is still on
then the reset hasn't finished yet.  The port hardware can't tell
whether or not a device is connected while it is driving a reset
signal.  (Well, maybe it can tell when the port is running at 
SuperSpeed, but it can't tell at lower speeds.)

Therefore it is important not to test USB_PORT_STAT_CONNECTION until 
after you have tested USB_PORT_STAT_RESET.

Alan Stern

--
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