public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: William Gulland <wgulland@google.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Sarah Sharp <sarah.a.sharp@linux.intel.com>,
	Lan Tianyu <tianyu.lan@intel.com>,
	Ming Lei <ming.lei@canonical.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: Clear both buffers when clearing a control transfer TT buffer.
Date: Fri, 28 Jun 2013 17:54:16 +0400	[thread overview]
Message-ID: <51CD9588.5010305@cogentembedded.com> (raw)
In-Reply-To: <1372374620-11790-1-git-send-email-wgulland@google.com>

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@google.com>
> ---
>   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


  reply	other threads:[~2013-06-28 13:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27 23:10 [PATCH] usb: Clear both buffers when clearing a control transfer TT buffer William Gulland
2013-06-28 13:54 ` Sergei Shtylyov [this message]
2013-06-28 15:56 ` Alan Stern
2013-07-01 20:41 ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51CD9588.5010305@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tianyu.lan@intel.com \
    --cc=wgulland@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox