public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: gadget: ci_udc: implement usb_ep_ops dequeue callback
Date: Thu, 27 Aug 2015 13:08:46 +0200	[thread overview]
Message-ID: <201508271308.46472.marex@denx.de> (raw)
In-Reply-To: <1440673250-17589-1-git-send-email-Peng.Fan@freescale.com>

On Thursday, August 27, 2015 at 01:00:50 PM, Peng Fan wrote:
> Implement endpoint dequeue callback function.
> 
> Without this function, uboot will hang when executing fastboot comamnd.
> See following flow:
> "fastboot_tx_write_str->fastboot_tx_write->usb_ep_dequeue->ep->ops->dequeue
> " without implement ci_udc dequeue function, ep->ops->dequeue is NULL, then
> uboot will hang.
> 
> Tested on mx6qsabresd board with fastboot enabled.
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: "?ukasz Majewski" <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
>  drivers/usb/gadget/ci_udc.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
> index 3e8eb87..f9374b3 100644
> --- a/drivers/usb/gadget/ci_udc.c
> +++ b/drivers/usb/gadget/ci_udc.c
> @@ -87,6 +87,7 @@ static int ci_ep_enable(struct usb_ep *ep,
>  static int ci_ep_disable(struct usb_ep *ep);
>  static int ci_ep_queue(struct usb_ep *ep,
>  		struct usb_request *req, gfp_t gfp_flags);
> +static int ci_ep_dequeue(struct usb_ep *ep, struct usb_request *req);
>  static struct usb_request *
>  ci_ep_alloc_request(struct usb_ep *ep, unsigned int gfp_flags);
>  static void ci_ep_free_request(struct usb_ep *ep, struct usb_request
> *_req); @@ -99,6 +100,7 @@ static struct usb_ep_ops ci_ep_ops = {
>  	.enable         = ci_ep_enable,
>  	.disable        = ci_ep_disable,
>  	.queue          = ci_ep_queue,
> +	.dequeue	= ci_ep_dequeue,
>  	.alloc_request  = ci_ep_alloc_request,
>  	.free_request   = ci_ep_free_request,
>  };
> @@ -525,6 +527,32 @@ static void ci_ep_submit_next_request(struct ci_ep
> *ci_ep) writel(bit, &udc->epprime);
>  }
> 
> +static int ci_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
> +{
> +	struct ci_ep *ci_ep = container_of(_ep, struct ci_ep, ep);
> +	struct ci_req *ci_req;
> +
> +	list_for_each_entry(ci_req, &ci_ep->queue, queue) {
> +		if (&ci_req->req == _req)
> +			break;
> +	}
> +
> +	if (&ci_req->req != _req)
> +		return -EINVAL;
> +
> +	list_del_init(&ci_req->queue);
> +
> +	if (ci_req->req.status == -EINPROGRESS) {
> +		ci_req->req.status = -ECONNRESET;
> +		if (ci_req->req.complete)
> +			ci_req->req.complete(_ep, _req);
> +	}
> +
> +	debug("callback completed\n");

Please fix this useless debug() statement, either remove it, or at least
make it print __func__ so one can identify where this came from.


Looks good otherwise:

Reviewed-by: Marek Vasut <marex@denx.de>

  reply	other threads:[~2015-08-27 11:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 11:00 [U-Boot] [PATCH] usb: gadget: ci_udc: implement usb_ep_ops dequeue callback Peng Fan
2015-08-27 11:08 ` Marek Vasut [this message]
2015-08-27 16:06   ` Stephen Warren
2015-08-28  0:05     ` Peng Fan
2015-08-30  7:26       ` Peng Fan
2015-09-01 19:45         ` Stephen Warren
2015-09-03 22:11           ` Marek Vasut
2015-09-09  2:17             ` Stephen Warren
2015-09-09  3:24               ` Peng Fan
2015-09-09  4:30                 ` Peng Fan
2015-09-09 23:20                   ` Marek Vasut
2015-08-28  0:02   ` Peng Fan

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=201508271308.46472.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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