LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Valentin Longchamp <valentin.longchamp@keymile.com>
Cc: dbrownell@users.sourceforge.net, stefan.bigler@keymile.com,
	linux-usb@vger.kernel.org, linuxppc-dev@ozlabs.org,
	holger.brunck@keymile.com
Subject: Re: [PATCH 1/1] fsl_qe_udc: send ZLP when zero flag and length % maxpacket == 0
Date: Thu, 17 Mar 2011 15:47:38 +0300	[thread overview]
Message-ID: <4D8202EA.1030405@ru.mvista.com> (raw)
In-Reply-To: <1300357858-1288-1-git-send-email-valentin.longchamp@keymile.com>

Hello.

On 17-03-2011 13:30, Valentin Longchamp wrote:

> The driver did not take the zero flag in the USB request. If the
> request length is the same as the endpoint's maxpacket, an additional
> ZLP with no data has to be transmitted.

> The method used here is inspired to what is done in fsl_udc_core.c
> (and pxa27x_udc.c and at91_udc.c) where this is supported.

> This is the first version of the patch, it may still contain mistakes,
> but I send it as a RFC since there already was a discussion about this
> topic with people from Keymile:

> http://thread.gmane.org/gmane.linux.usb.general/38951

> Signed-off-by: Valentin Longchamp<valentin.longchamp@keymile.com>
> ---
>   drivers/usb/gadget/fsl_qe_udc.c |   28 +++++++++++++++++++++++-----
>   1 files changed, 23 insertions(+), 5 deletions(-)

> diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
> index 8dc15da..08538f5 100644
> --- a/drivers/usb/gadget/fsl_qe_udc.c
> +++ b/drivers/usb/gadget/fsl_qe_udc.c
[...]
> @@ -1158,13 +1164,24 @@ static int txcomplete(struct qe_ep *ep, unsigned char restart)
>   			ep->last = 0;
>   		}
>
> +		/* zlp needed when req->re.zero is set */
> +		if (req->req.zero) {
> +			if (last_len == 0 ||
> +				(req->req.length % ep->ep.maxpacket) != 0)
> +				zlp = 0;
> +			else
> +				zlp = 1;
> +		} else
> +			zlp = 0;
> +
>   		/* a request already were transmitted completely */
>   		if ((ep->tx_req->req.length - ep->sent) <= 0) {
> -			ep->tx_req->req.actual = (unsigned int)ep->sent;
> -			done(ep, ep->tx_req, 0);
> -			ep->tx_req = NULL;
> -			ep->last = 0;
> -			ep->sent = 0;
> +			if (!zlp) {

    This *if* could be collapsed into previous *if*, and so the subsequest 
indentation level not changed.

> +				done(ep, ep->tx_req, 0);
> +				ep->tx_req = NULL;
> +				ep->last = 0;
> +				ep->sent = 0;
> +			}
>   		}
>   	}
>

WBR, Sergei

           reply	other threads:[~2011-03-17 12:49 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1300357858-1288-1-git-send-email-valentin.longchamp@keymile.com>]

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=4D8202EA.1030405@ru.mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=holger.brunck@keymile.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=stefan.bigler@keymile.com \
    --cc=valentin.longchamp@keymile.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