From patchwork Tue Jun 18 15:03:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2742861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E6A819F8E1 for ; Tue, 18 Jun 2013 15:08:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D160D2049B for ; Tue, 18 Jun 2013 15:08:28 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA6B9204A0 for ; Tue, 18 Jun 2013 15:08:23 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoxTr-0005Wt-R6; Tue, 18 Jun 2013 15:06:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoxTG-0002hK-M9; Tue, 18 Jun 2013 15:05:22 +0000 Received: from mail-pb0-x236.google.com ([2607:f8b0:400e:c01::236]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoxT3-0002ee-Ch for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2013 15:05:10 +0000 Received: by mail-pb0-f54.google.com with SMTP id ro2so3999051pbb.13 for ; Tue, 18 Jun 2013 08:04:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=LW/O0MoMSHG14REusA2JGog3SPMafhaXSnqw6LCxVY8=; b=jWNMUGZ0cV4jCIOHz81L9lY+ZY657c3Q5NCNpUyoc+Mh+vo0U8zEXQ70s1ai9X+gj8 2IuyP8BoQDWA6Gb99biQ8rEFOc75DMi76mVU2aoBACzLbpM3WcbhN0C/ySk5thSvzc/6 B4jzNNM2jMcAlU/JRyrn/AvSfeynLfdDYfTctNem1nhpX8cB7Q5NBscgz7FlNtN15R5h Acz5E1UB9j4TOkYBxjYxMHH8uiy4CqVObaHGBqCafXLakjgpMSj0uDdHznFnDaOJXF2Z piIRjvZcqboHqzbTs5ojRzmjxXfbl/c2JX1wYqZMy6j8hALEK7TW1Vxk/onDgJLEUALt nkEA== X-Received: by 10.66.162.40 with SMTP id xx8mr2456463pab.178.1371567887079; Tue, 18 Jun 2013 08:04:47 -0700 (PDT) Received: from localhost ([183.37.201.115]) by mx.google.com with ESMTPSA id ra4sm20044857pab.9.2013.06.18.08.04.42 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 18 Jun 2013 08:04:46 -0700 (PDT) From: Ming Lei To: Greg Kroah-Hartman Subject: [RFC PATCH v1 4/6] USB: EHCI: don't release ehci->lock if URB giveback in tasklet context Date: Tue, 18 Jun 2013 23:03:50 +0800 Message-Id: <1371567833-9077-5-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1371567833-9077-1-git-send-email-ming.lei@canonical.com> References: <1371567833-9077-1-git-send-email-ming.lei@canonical.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130618_110509_557923_023AB821 X-CRM114-Status: GOOD ( 10.23 ) X-Spam-Score: -1.9 (-) Cc: Oliver Neukum , Ming Lei , linux-usb@vger.kernel.org, Steven Rostedt , Alan Stern , Thomas Gleixner , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 If HCD_BH is set for HC driver's flags, URB giveback will be done in tasklet context instead of interrupt context, so the ehci->lock needn't to be released any more before calling usb_hcd_giveback_urb(). Cc: Alan Stern Signed-off-by: Ming Lei --- drivers/usb/host/ehci-q.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index d34b399..0387a81 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c @@ -283,9 +283,11 @@ __acquires(ehci->lock) /* complete() can reenter this HCD */ usb_hcd_unlink_urb_from_ep(ehci_to_hcd(ehci), urb); - spin_unlock (&ehci->lock); + if (!hcd_giveback_urb_in_bh(ehci_to_hcd(ehci))) + spin_unlock(&ehci->lock); usb_hcd_giveback_urb(ehci_to_hcd(ehci), urb, status); - spin_lock (&ehci->lock); + if (!hcd_giveback_urb_in_bh(ehci_to_hcd(ehci))) + spin_lock(&ehci->lock); } static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh);