Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757797AbcJRCkv (ORCPT ); Mon, 17 Oct 2016 22:40:51 -0400 Received: from mail-yw0-f174.google.com ([209.85.161.174]:34470 "EHLO mail-yw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754873AbcJRCkl (ORCPT ); Mon, 17 Oct 2016 22:40:41 -0400 MIME-Version: 1.0 In-Reply-To: <87d1izry21.fsf@linux.intel.com> References: <87mvi3s2vb.fsf@linux.intel.com> <87d1izry21.fsf@linux.intel.com> From: Baolin Wang Date: Tue, 18 Oct 2016 10:40:39 +0800 Message-ID: Subject: Re: [PATCH v4] usb: dwc3: Wait for control tranfer completed when stopping gadget To: Felipe Balbi Cc: 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: 1046 Lines: 29 Hi, On 17 October 2016 at 19:53, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: >>> Baolin Wang writes: >>>> When we change the USB function with configfs dynamically, we possibly met this >>>> situation: one core is doing the control transfer, another core is trying to >>>> unregister the USB gadget from userspace, we must wait for completing this >>>> control tranfer, or it will hang the controller to set the DEVCTRLHLT flag. >>>> >>>> Signed-off-by: Baolin Wang >>> >>> Can you make sure this still works? >> >> With applying this patch, It can work well on my platform, but I have >> some worries about the risk of accessing 'dwc->ep0state' without lock >> protection in dwc3_gadget_pullup() function. > > hmm, I might be missing something, but I think there's no risk here. If > anything, a wmb() is probably enough before reading ep0state. No? OK, I agree with you and I think a wmb() is not useful here. -- Baolin.wang Best Regards