From patchwork Sun Jun 9 15:18:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2694311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 6A4CD3FC23 for ; Sun, 9 Jun 2013 15:21:27 +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 1UlhPp-00088Q-Db; Sun, 09 Jun 2013 15:20:25 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UlhPS-0006kF-6r; Sun, 09 Jun 2013 15:19:58 +0000 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UlhPO-0006hm-3n for linux-arm-kernel@lists.infradead.org; Sun, 09 Jun 2013 15:19:54 +0000 Received: by mail-pa0-f44.google.com with SMTP id lj1so614882pab.31 for ; Sun, 09 Jun 2013 08:19:32 -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=IkMs1+JnY3cGAz7lTEsCRqY3gmhlbhMLLxzhYBCAmxcq3aib2Xa3b1UZ7wn2tFfX/g LpVtutRslZCEkx2HZ77PPKKWnnAa375JoMZ6ZU38+kMDvZQjqf46LXJZ3cGtk64d5YNJ NM+VmHjSSbypnJAyTM+Dy1+Nav9QS6IfLcWkMXu6rfezBrWFalx7bvf/TAFDVFy+Ok6o ZxGve9vfRBHCaGKoUSqeBOb8mAFmoXzDNLcOzTHclfV4PVIVh8cIximxgoiVVZzmYkZM gxme+Dr5I6oyqGuSgZ7C5mr3NpLBbUzVwG8W64I2V12AXxTbX4qzYtQGdujJPcGT9zH2 AOVg== X-Received: by 10.66.164.199 with SMTP id ys7mr10509053pab.104.1370791172594; Sun, 09 Jun 2013 08:19:32 -0700 (PDT) Received: from localhost ([183.37.199.34]) by mx.google.com with ESMTPSA id 6sm6873521pbn.45.2013.06.09.08.19.28 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 09 Jun 2013 08:19:31 -0700 (PDT) From: Ming Lei To: Greg Kroah-Hartman Subject: [RFC PATCH 2/4] USB: EHCI: don't release ehci->lock if URB giveback in tasklet context Date: Sun, 9 Jun 2013 23:18:29 +0800 Message-Id: <1370791112-18464-3-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1370791112-18464-1-git-send-email-ming.lei@canonical.com> References: <1370791112-18464-1-git-send-email-ming.lei@canonical.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130609_111954_286340_17F0BA09 X-CRM114-Status: UNSURE ( 9.07 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tom.leiming[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Ming Lei , linux-usb@vger.kernel.org, Alan Stern , 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 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);