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: 38893 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 40CAC2054E for ; Fri, 17 Oct 2014 15:47:26 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id hi2sf716085wib.5 for ; Fri, 17 Oct 2014 08:47:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :reply-to:references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=5s9NbU4fNpagQ8lGjeaCFF2zgLRp4nB6n4YJCkyqBjE=; b=bJ+wJuIUave5SHWY83POi8z/2AWduI46RZLD2f0hT3iQVNOIUzvKKn9Fjx9M8R9eLw 8WXjFN7kwNyJ0Ta19LeWqhNSUm8C0QGfKm97hlY3aW1gv/0ho3FldDo0ekhRTakXaZZX +LoRJep6RL0jjE4VrcQaH1bA8gce6INBqZxQRKzv/IlzBK69NwYAxiqVhCaez88VQiFb vM44/gM5i9nHRmlCoIZ/cGkqtN/IAMZBcUoY6WfQez736JtlkZwKbnWEd7VuMWyLqQiL JZJvCFigUD5BPhBAOYUYwO30gWZJ8GepEAH7qIMmA9SZvDAsCI+/Y/rKkQCP8r+yTC8n vcyQ== X-Gm-Message-State: ALoCoQmeX312kLTK2N0xw9RmlGNVrtzvO3Gg6LXA2KxolCUnHVtU/Y88mAuG7fLsPquN6SyV+wy7 X-Received: by 10.152.88.70 with SMTP id be6mr1522305lab.1.1413560845445; Fri, 17 Oct 2014 08:47:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.38 with SMTP id n6ls254042laj.86.gmail; Fri, 17 Oct 2014 08:47:25 -0700 (PDT) X-Received: by 10.153.9.7 with SMTP id do7mr3771125lad.98.1413560845165; Fri, 17 Oct 2014 08:47:25 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id zm10si2575201lbb.125.2014.10.17.08.47.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 08:47:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id n15so917246lbi.11 for ; Fri, 17 Oct 2014 08:47:25 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr1429992lbw.66.1413560845040; Fri, 17 Oct 2014 08:47:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp252774lbz; Fri, 17 Oct 2014 08:47:23 -0700 (PDT) X-Received: by 10.66.180.166 with SMTP id dp6mr9251476pac.101.1413560842266; Fri, 17 Oct 2014 08:47:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sd1si1442196pac.150.2014.10.17.08.47.20 for ; Fri, 17 Oct 2014 08:47:22 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753235AbaJQPrT (ORCPT + 6 others); 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: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;