From patchwork Fri Oct 17 17:09:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 38924 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 23F8C202DB for ; Fri, 17 Oct 2014 17:11:19 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf717532lbg.5 for ; Fri, 17 Oct 2014 10:11:17 -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:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=ZRTmd96lIHLt2BT56iRph+qDY2A8Wk0+JRV3GAYUbe0=; b=QaHANY7mbs92mM3z0mIb4qIuaCxVMTo1/oqiCqouqMV+cWJ/0MC0zTELeXhYIJ8irC 8hPSxnRc9l0W3VwiydVyR3R7W1uUuBygZSExcFFAk/abpGohfXp4iaapsr7Fr8XUlWDz rApaSd/xZgFfLsFvT2i+E/GXLfHWNbe/VhRyWBfaUHG1/TCCXzc8YeBa6GKzDI9hWp6i UU1RgEYlVVMHOLHlsiomCQJAn/FU2ui70hVB0dgjE5OZ8ZQ0joB5Hhy4wUCI9bGGF2RU wcoD54FTgfkI7MnU/eyAlBwgt3adqEc5EjjZFbuv5nlUjlrW9jtKBy+FQhXxhueB6RLu 2zCQ== X-Gm-Message-State: ALoCoQk179RGsvclVrswsGX8tDpY88z5XN8/TWgRFXvcO2ycSotid09opKXlMKc62y+uBzBgH3q2 X-Received: by 10.180.72.141 with SMTP id d13mr50838wiv.6.1413565877885; Fri, 17 Oct 2014 10:11:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.133 with SMTP id o5ls279659lal.35.gmail; Fri, 17 Oct 2014 10:11:17 -0700 (PDT) X-Received: by 10.112.156.138 with SMTP id we10mr4642805lbb.88.1413565877441; Fri, 17 Oct 2014 10:11:17 -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 bf9si2923556lab.114.2014.10.17.10.11.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 10:11:17 -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 n15so1008651lbi.25 for ; Fri, 17 Oct 2014 10:11:17 -0700 (PDT) X-Received: by 10.152.29.8 with SMTP id f8mr10248103lah.56.1413565877370; Fri, 17 Oct 2014 10:11:17 -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 c5csp266866lbz; Fri, 17 Oct 2014 10:11:16 -0700 (PDT) X-Received: by 10.68.234.103 with SMTP id ud7mr9985923pbc.46.1413565875904; Fri, 17 Oct 2014 10:11:15 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si1689853pdo.55.2014.10.17.10.11.15 for ; Fri, 17 Oct 2014 10:11:15 -0700 (PDT) Received-SPF: none (google.com: linux-usb-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 S1753646AbaJQRLM (ORCPT + 3 others); Fri, 17 Oct 2014 13:11:12 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:43991 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753398AbaJQRKU (ORCPT ); Fri, 17 Oct 2014 13:10:20 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HHAJ3i007448 for ; Fri, 17 Oct 2014 12:10:19 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAJii023096 for ; Fri, 17 Oct 2014 12:10:19 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 12:10:18 -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 s9HHAIul021616; Fri, 17 Oct 2014 12:10:19 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH 04/28] usb: dwc3: gadget: hold the lock through set_wedge()'s life Date: Fri, 17 Oct 2014 12:09:40 -0500 Message-ID: <1413565804-13061-5-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT In-Reply-To: <1413565804-13061-1-git-send-email-balbi@ti.com> References: <1413565804-13061-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@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: , Instead of releasing the lock and calling locked versions of our set_halt() methods, let's hold the lock all the way through and call unlocked versions of those functions. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index fd92f63..b98295e 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1257,15 +1257,18 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep) struct dwc3_ep *dep = to_dwc3_ep(ep); struct dwc3 *dwc = dep->dwc; unsigned long flags; + int ret; spin_lock_irqsave(&dwc->lock, flags); dep->flags |= DWC3_EP_WEDGE; - spin_unlock_irqrestore(&dwc->lock, flags); if (dep->number == 0 || dep->number == 1) - return dwc3_gadget_ep0_set_halt(ep, 1); + ret = __dwc3_gadget_ep0_set_halt(ep, 1); else - return dwc3_gadget_ep_set_halt(ep, 1); + ret = __dwc3_gadget_ep_set_halt(dep, 1); + spin_unlock_irqrestore(&dwc->lock, flags); + + return ret; } /* -------------------------------------------------------------------------- */