From patchwork Fri Oct 17 15:46:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 5098161 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5E015C11AC for ; Fri, 17 Oct 2014 15:47:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BAA8620200 for ; Fri, 17 Oct 2014 15:47:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F22D201CD for ; Fri, 17 Oct 2014 15:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753235AbaJQPrT (ORCPT ); Fri, 17 Oct 2014 11:47:19 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:60295 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752032AbaJQPqo (ORCPT ); Fri, 17 Oct 2014 11:46:44 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HFkeGC007610; Fri, 17 Oct 2014 10:46:40 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HFkeA2030626; Fri, 17 Oct 2014 10:46:40 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 10:46:40 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HFkdl0003740; Fri, 17 Oct 2014 10:46:39 -0500 Date: Fri, 17 Oct 2014 10:46:30 -0500 From: Felipe Balbi To: Felipe Balbi CC: Marek Szyprowski , , , Kyungmin Park , Robert Baldyga , Paul Zimmerman , Krzysztof Kozlowski Subject: Re: [PATCH 3/9] usb: dwc2/gadget: fix support for soft_connect udc framework feature Message-ID: <20141017154630.GQ26260@saruman> Reply-To: References: <1413464285-24172-1-git-send-email-m.szyprowski@samsung.com> <1413464285-24172-4-git-send-email-m.szyprowski@samsung.com> <20141016133610.GH3480@saruman> <5440F2E4.3030901@samsung.com> <20141017154435.GP26260@saruman> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20141017154435.GP26260@saruman> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, On Fri, Oct 17, 2014 at 10:44:35AM -0500, Felipe Balbi wrote: > On Fri, Oct 17, 2014 at 12:43:48PM +0200, Marek Szyprowski wrote: > > Hello, > > > > On 2014-10-16 15:36, Felipe Balbi wrote: > > >On Thu, Oct 16, 2014 at 02:57:59PM +0200, Marek Szyprowski wrote: > > >>Enabling and disabling usb gadget by writing to > > >>/sys/class/udc/*hsotg/soft_connect results in calling udc_start/udc_stop > > >>functions with the same usb gadget driver, so the driver should not WARN > > >>about such case. > > >> > > >>Signed-off-by: Marek Szyprowski > > >>--- > > >> drivers/usb/dwc2/gadget.c | 2 +- > > >> 1 file changed, 1 insertion(+), 1 deletion(-) > > >> > > >>diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c > > >>index 8870e38c1d82..37fda4c03397 100644 > > >>--- a/drivers/usb/dwc2/gadget.c > > >>+++ b/drivers/usb/dwc2/gadget.c > > >>@@ -2892,7 +2892,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, > > >> return -EINVAL; > > >> } > > >>- WARN_ON(hsotg->driver); > > >>+ WARN_ON(hsotg->driver && hsotg->driver != driver); > > >the bug is in your ->udc_stop(). You should clear hsotg->driver to NULL > > >there. > > > > Ok, I will change udc_stop() to always zero hsotg->driver, like other udc > > drivers. I was a bit confused by the fact that udc core passes driver to > > udc_stop(), when called from soft_connect and NULL on gadget removal. > > That can probably be cleaned up, I'll go have a look on all UDCs and > make sure I won't break anything. looks like chipidea is the only one still using that argument, if you make your patch look like below: I'll remove the argument. diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7b5856f..ac14328 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2934,8 +2934,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, spin_lock_irqsave(&hsotg->lock, flags); - if (!driver) - hsotg->driver = NULL; + hsotg->driver = NULL; hsotg->gadget.speed = USB_SPEED_UNKNOWN;