Re: [PATCH] usb: dwc3: gadget: decrease the queued_requests in removal

From: Felipe Balbi
Date: Mon Jan 08 2018 - 06:53:43 EST



Hi,

Lipengcheng <lpc.li@xxxxxxxxxxxxx> writes:
> In removal requests, it is necessary to make the corresponding trb
> disable state (HWO = 1) and dep->queued_requests a corresponding reduction.
> It is better to use a alone funtion to disable trb (HWO = 0).

this shouldn't be necessary. What problem are you facing? what happens?
Where are the tracepoint logs? Which kernel are you using? did you try
mainline?

> Signed-off-by: Pengcheng Li <lpc.li@xxxxxxxxxxxxx>
> ---
> drivers/usb/dwc3/gadget.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 1e6c42e..273b51d 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -707,6 +707,36 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
> ÂÂÂ while (!list_empty(&dep->started_list)) {

why all these underscore characters? Are you sending html emails?

> ÂÂÂÂÂÂÂ req = next_request(&dep->started_list);
>
> +ÂÂÂÂÂÂ if (req->trb) {
> +ÂÂÂÂÂÂÂÂÂÂ if (req->num_pending_sgs) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ struct dwc3_trb *trb;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ int i = 0;
> +
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ for (i = 0; i < req->num_pending_sgs; i++) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ trb = req->trb + i;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ dwc3_ep_inc_deq(dep);
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ }
> +
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (req->unaligned || req->zero) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ trb = req->trb + req->num_pending_sgs + 1;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ dwc3_ep_inc_deq(dep);
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ }
> +ÂÂÂÂÂÂÂÂÂÂ } else {
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ struct dwc3_trb *trb = req->trb;
> +
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ dwc3_ep_inc_deq(dep);
> +
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (req->unaligned || req->zero) {
> +ÂÂÂÂÂÂÂÂÂ ÂÂÂÂÂÂÂÂÂtrb = req->trb + 1;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ dwc3_ep_inc_deq(dep);
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ }
> +ÂÂÂÂÂÂÂÂÂÂ }
> +ÂÂÂÂÂÂ }
> +ÂÂÂÂÂÂ dep->queued_requests--;
> ÂÂÂÂÂÂÂ dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
> ÂÂÂ }

you have a lot to fix here.

--
balbi

Attachment: signature.asc
Description: PGP signature