From: Felipe Balbi <balbi@kernel.org>
To: Baolin Wang <baolin.wang@linaro.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
Mark Brown <broonie@kernel.org>, USB <linux-usb@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND PATCH v3 2/2] usb: dwc3: Wait for control tranfer completed when stopping gadget
Date: Thu, 13 Oct 2016 10:54:54 +0300 [thread overview]
Message-ID: <87fuo0vg35.fsf@linux.intel.com> (raw)
In-Reply-To: <CAMz4kuLQK8bkjGqjuUVTh6ZrMXk=xB7B0Ka=TRj4BD8iSG4ZDw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1662 bytes --]
Hi,
Baolin Wang <baolin.wang@linaro.org> writes:
> Hi,
>
> On 13 October 2016 at 15:08, Felipe Balbi <balbi@kernel.org> wrote:
>>
>> Hi,
>>
>> Baolin Wang <baolin.wang@linaro.org> writes:
>>> @@ -1487,10 +1496,22 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
>>>
>>> is_on = !!is_on;
>>>
>>> +try_again:
>>> spin_lock_irqsave(&dwc->lock, flags);
>>> ret = dwc3_gadget_run_stop(dwc, is_on, false);
>>> spin_unlock_irqrestore(&dwc->lock, flags);
>>>
>>> + if (ret == -EBUSY) {
>>> + ret = wait_for_completion_timeout(&dwc->ep0_in_setup,
>>> + msecs_to_jiffies(500));
>>> + if (ret == 0) {
>>> + dev_err(dwc->dev, "timeout to stop gadget.\n");
>>> + ret = -ETIMEDOUT;
>>> + } else {
>>> + goto try_again;
>>
>> you are not really reading my comments. It's the third time I tell you
>> there's no need for try_again. If you can't complete a control transfer
>> in 500ms, you already have other issues. Take this thing out of here.
>
> I think you misunderstood the code. If there is 500ms timeout, we will
> return '-ETIMEDOUT' error. If the control transfer is completed before
> timeout, we can not just return and we need try again to stop the
> gadget, right? Any other good suggestion? Thanks.
Yeah, change the patch a bit so you wait for completion before calling
dwc3_gadget_runt_stop()? I mean, move the !is_on && ep0_state check
before calling dwc3_gadget_run_stop() and wait_for_completion_timeout()
there.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
next prev parent reply other threads:[~2016-10-13 7:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 8:42 [RESEND PATCH v3 1/2] usb: dwc3: gadget: Add disconnect checking when changing function dynamically Baolin Wang
2016-10-04 8:42 ` [RESEND PATCH v3 2/2] usb: dwc3: Wait for control tranfer completed when stopping gadget Baolin Wang
2016-10-13 7:08 ` Felipe Balbi
2016-10-13 7:51 ` Baolin Wang
2016-10-13 7:54 ` Felipe Balbi [this message]
2016-10-13 8:01 ` Baolin Wang
2016-10-13 7:06 ` [RESEND PATCH v3 1/2] usb: dwc3: gadget: Add disconnect checking when changing function dynamically Felipe Balbi
2016-10-13 7:37 ` Baolin Wang
2016-10-13 8:16 ` Janusz Dziedzic
2016-10-13 8:21 ` Baolin Wang
2016-10-13 8:28 ` Janusz Dziedzic
2016-10-13 8:39 ` Baolin Wang
2016-10-13 9:49 ` Felipe Balbi
2016-10-13 10:41 ` Baolin Wang
2016-10-13 11:16 ` Janusz Dziedzic
2016-10-13 11:22 ` Felipe Balbi
2016-10-13 11:30 ` Baolin Wang
2016-10-13 11:46 ` Baolin Wang
2016-10-13 12:17 ` Felipe Balbi
2016-10-13 12:23 ` Baolin Wang
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=87fuo0vg35.fsf@linux.intel.com \
--to=balbi@kernel.org \
--cc=baolin.wang@linaro.org \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.