Re: usb_stor_control_msg() timeout argument

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

 



On Fri, 17 Oct 2014, Mark Knibbs wrote:

> Hi,
> 
> In include/linux/usb.h, there is
> /*
>  * timeouts, in milliseconds, used for sending/receiving control messages
>  * they typically complete within a few frames (msec) after they're issued
>  * USB identifies 5 second timeouts, maybe more in a few cases, and a few
>  * slow devices (like some MGE Ellipse UPSes) actually push that limit.
>  */
> #define USB_CTRL_GET_TIMEOUT    5000
> #define USB_CTRL_SET_TIMEOUT    5000

Those timeout values are used with usb_control_msg(), which takes 
timeout values in milliseconds.

> However several callers of usb_stor_control_msg() have timeout argument
> specified as n*HZ, for example in drivers/usb/storage/transport.c:
> 
>         result = usb_stor_control_msg(us, us->send_ctrl_pipe,
>                 USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT,
>                 USB_ENDPOINT_HALT, endp,
>                 NULL, 0, 3*HZ);
> 
>         result = usb_stor_control_msg(us, us->recv_ctrl_pipe,
>                                  US_BULK_GET_MAX_LUN, 
>                                  USB_DIR_IN | USB_TYPE_CLASS | 
>                                  USB_RECIP_INTERFACE,
>                                  0, us->ifnum, us->iobuf, 1, 10*HZ);
> 
>         result = usb_stor_control_msg(us, us->send_ctrl_pipe,
>                         request, requesttype, value, index, data, size,
>                         5*HZ);

This is because usb_stor_control_msg accepts timeout values in jiffies.

> I'm just wondering whether those callers should have timeouts in ms (so
> 3*HZ -> 3000), or whether the definitions of USB_CTRL_GET/SET_TIMEOUT
> should be 5*HZ? Or is HZ always 1000 these days?

No, no, and no.

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