From patchwork Thu Jul 11 09:05:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2826072 Return-Path: X-Original-To: patchwork-linux-media@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 A5A8E9F7D6 for ; Thu, 11 Jul 2013 09:07:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78244200B9 for ; Thu, 11 Jul 2013 09:07:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5F8B2011B for ; Thu, 11 Jul 2013 09:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756006Ab3GKJHE (ORCPT ); Thu, 11 Jul 2013 05:07:04 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:43309 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755838Ab3GKJHA (ORCPT ); Thu, 11 Jul 2013 05:07:00 -0400 Received: by mail-pb0-f54.google.com with SMTP id ro2so7682660pbb.41 for ; Thu, 11 Jul 2013 02:07:00 -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=1NRZKTQudzzCpCObweH1FjNtFnJKs4YQyZcPtUqL2aE=; b=I+Ty8tW+BeYHL5H19prHZgid3Xf09WWPmwqm2R04aJubf7twBSl6GjNe8iNQxABsU6 1d6LRTQ+B5KNHcUrEbPN5wedjQBZdfPoXebcQhb0ycHFdu5du++hoHjMF4M9I5LbViiS 5kL9UY7FU4Po7a/2X2nS9YNs/8xs4ZeXtuwQ63dGrCegWlt2DCRpDXwSd/nkGojsoNSi YZDm2goQZxPx/N3Fh3trFRXqcauYUuifMswSO3LbydhE9HpwHD/KnPgj6ohl7dMllIkr 6Ozjw0Y12jftPqmYA8S/w9rbmU7LCUa0JYvK6KgxJ/7Xj4Rvjc0hiODFzrZ/HhXv+xeG a1iA== X-Received: by 10.66.241.1 with SMTP id we1mr36580904pac.83.1373533620004; Thu, 11 Jul 2013 02:07:00 -0700 (PDT) Received: from localhost ([183.37.203.123]) by mx.google.com with ESMTPSA id vb8sm38648801pbc.11.2013.07.11.02.06.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 11 Jul 2013 02:06:58 -0700 (PDT) From: Ming Lei To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, Oliver Neukum , Alan Stern , linux-input@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-media@vger.kernel.org, alsa-devel@alsa-project.org, Ming Lei , Pete Zaitcev Subject: [PATCH 03/50] USB: usblp: spin_lock in complete() cleanup Date: Thu, 11 Jul 2013 17:05:26 +0800 Message-Id: <1373533573-12272-4-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1373533573-12272-1-git-send-email-ming.lei@canonical.com> References: <1373533573-12272-1-git-send-email-ming.lei@canonical.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Complete() will be run with interrupt enabled, so change to spin_lock_irqsave(). Cc: Pete Zaitcev Signed-off-by: Ming Lei --- drivers/usb/class/usblp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index d4c47d5..04163d8 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -297,6 +297,7 @@ static void usblp_bulk_read(struct urb *urb) { struct usblp *usblp = urb->context; int status = urb->status; + unsigned long flags; if (usblp->present && usblp->used) { if (status) @@ -304,14 +305,14 @@ static void usblp_bulk_read(struct urb *urb) "nonzero read bulk status received: %d\n", usblp->minor, status); } - spin_lock(&usblp->lock); + spin_lock_irqsave(&usblp->lock, flags); if (status < 0) usblp->rstatus = status; else usblp->rstatus = urb->actual_length; usblp->rcomplete = 1; wake_up(&usblp->rwait); - spin_unlock(&usblp->lock); + spin_unlock_irqrestore(&usblp->lock, flags); usb_free_urb(urb); } @@ -320,6 +321,7 @@ static void usblp_bulk_write(struct urb *urb) { struct usblp *usblp = urb->context; int status = urb->status; + unsigned long flags; if (usblp->present && usblp->used) { if (status) @@ -327,7 +329,7 @@ static void usblp_bulk_write(struct urb *urb) "nonzero write bulk status received: %d\n", usblp->minor, status); } - spin_lock(&usblp->lock); + spin_lock_irqsave(&usblp->lock, flags); if (status < 0) usblp->wstatus = status; else @@ -335,7 +337,7 @@ static void usblp_bulk_write(struct urb *urb) usblp->no_paper = 0; usblp->wcomplete = 1; wake_up(&usblp->wwait); - spin_unlock(&usblp->lock); + spin_unlock_irqrestore(&usblp->lock, flags); usb_free_urb(urb); }