Re: [PATCH] usb: Clear both buffers when clearing a control transfer TT buffer.

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

 



Hello.

On 28-06-2013 3:10, William Gulland wrote:

     Control transfers have both IN and OUT (or SETUP) packets, so when
     clearing TT buffers for a control transfer it's necessary to send
     two HUB_CLEAR_TT_BUFFER requests to the hub.

Signed-off-by: William Gulland <wgulland@xxxxxxxxxx>
---
  drivers/usb/core/hub.c | 9 +++++++++
  1 file changed, 9 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index feef935..868ad74 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -668,6 +668,15 @@ resubmit:
  static inline int
  hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
  {
+	/* Need to clear both directions for control ep */
+	if (((devinfo >> 11) & USB_ENDPOINT_XFERTYPE_MASK) ==
+			USB_ENDPOINT_XFER_CONTROL) {
+		int status = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
+				HUB_CLEAR_TT_BUFFER, USB_RT_PORT,
+				devinfo ^ 0x8000, tt, NULL, 0, 1000);

   Could you use consistent indentation style with the below call?
Also, empty line wouldn't hurt after declaration...

+		if (status)
+			return status;
+	}
  	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
  			       HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,
  			       tt, NULL, 0, 1000);

WBR, Sergei

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