Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752820AbcJMI2y (ORCPT ); Thu, 13 Oct 2016 04:28:54 -0400 Received: from mail-yb0-f180.google.com ([209.85.213.180]:36654 "EHLO mail-yb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752338AbcJMI2U (ORCPT ); Thu, 13 Oct 2016 04:28:20 -0400 MIME-Version: 1.0 In-Reply-To: References: <521625dd7f5e335e2a681ec65ebffc5832207e5f.1475570367.git.baolin.wang@linaro.org> <87oa2ovicc.fsf@linux.intel.com> From: Baolin Wang Date: Thu, 13 Oct 2016 16:21:34 +0800 Message-ID: Subject: Re: [RESEND PATCH v3 1/2] usb: dwc3: gadget: Add disconnect checking when changing function dynamically To: Janusz Dziedzic Cc: Felipe Balbi , Greg KH , Mark Brown , USB , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2517 Lines: 91 Hi, On 13 October 2016 at 16:16, Janusz Dziedzic wrote: > On 13 October 2016 at 09:37, Baolin Wang wrote: >> Hi, >> >> On 13 October 2016 at 15:06, Felipe Balbi wrote: >>> >>> Hi, >>> >>> Baolin Wang writes: >>>> When system has stpped the gadget, we should avoid queuing any requests >>> >>> queueing is *not* a problem. Starting is. In fact, that's what your >>> patch is doing. >> >> OK. >> >>> >>>> which will cause tranfer failed. Thus adding some disconnect checking to >>> ^^^^^^^ >>> transfer >> >> Sorry for spelling mistake, will fix it. >> >>> >>>> avoid this situation. >>>> >>>> Signed-off-by: Baolin Wang >>>> --- >>>> Changes since v2: >>>> - Move disconnect checking into dwc3_send_gadget_ep_cmd(). >>>> - Rename completion name and issue complete() at one place. >>>> - Move completion initialization into dwc3_gadget_init(). >>>> >>>> Changes since v1: >>>> - Split into 2 separate ptaches. >>>> - Choose complete mechanism instead of polling. >>>> --- >>>> drivers/usb/dwc3/gadget.c | 3 +++ >>>> 1 file changed, 3 insertions(+) >>>> >>>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c >>>> index 1783406..ca2ae5b 100644 >>>> --- a/drivers/usb/dwc3/gadget.c >>>> +++ b/drivers/usb/dwc3/gadget.c >>>> @@ -241,6 +241,9 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd, >>>> int susphy = false; >>>> int ret = -EINVAL; >>>> >>>> + if (!dwc->pullups_connected) >>>> + return -ESHUTDOWN; >>>> + > > you skip trace_dwc3_gadget_ep_cmd() Yes, we did not need trace here since we did not send out the command. > > BR > Janusz > >>>> /* >>>> * Synopsys Databook 2.60a states, on section 6.3.2.5.[1-8], that if >>>> * we're issuing an endpoint command, we must check if >>>> -- >>>> 1.7.9.5 >>>> >>>> -- >>>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in >>>> the body of a message to majordomo@vger.kernel.org >>>> More majordomo info at http://vger.kernel.org/majordomo-info.html >>> >>> -- >>> balbi >> >> >> >> -- >> Baolin.wang >> Best Regards >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-usb" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html -- Baolin.wang Best Regards