From patchwork Thu Jul 11 09:05:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2826071 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 004E39F7D6 for ; Thu, 11 Jul 2013 09:07:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C688D2011D for ; Thu, 11 Jul 2013 09:07:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C5A2200B9 for ; Thu, 11 Jul 2013 09:07:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755991Ab3GKJGz (ORCPT ); Thu, 11 Jul 2013 05:06:55 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:57851 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755838Ab3GKJGw (ORCPT ); Thu, 11 Jul 2013 05:06:52 -0400 Received: by mail-pd0-f172.google.com with SMTP id z10so7280636pdj.3 for ; Thu, 11 Jul 2013 02:06:51 -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=4M72U21QbPb4qr1x8RRndt8nrG2FQzMTWvyzLfKSDIg=; b=dsR9NCBSI5V4eUHBRozowwQkFkySpWGyLjauNsqgxO05sRxNOfKSylhwxduHjoG0I7 XYbmza5IwE7WAWxm7dA6+TbQF0CAyKurr3kxVGrIBxSgibOKHEpM2eVX4BEyOXdqbm0p GAOsqSQJOHacV6nlW29FJihbPaHP9g3cs34uAUf7AaASKlAkFSeqCNmtxnpPpFKOw4Ol vvFl9Yjau1jPMmHdLBFTE3qL5RkX58YZGB8X7GMDF6oeiVYDBucHCdJJllUep91S7Fkw SP/URv89xW56H8LktpAyOhrfogwj6Iq7wlNuEBy5nseikYLAAkE+TLBjVS26O6H4iMmS /euA== X-Received: by 10.66.27.147 with SMTP id t19mr37087296pag.171.1373533611642; Thu, 11 Jul 2013 02:06:51 -0700 (PDT) Received: from localhost ([183.37.203.123]) by mx.google.com with ESMTPSA id qv4sm38639392pbc.16.2013.07.11.02.06.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 11 Jul 2013 02:06:50 -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 Subject: [PATCH 02/50] USB: cdc-wdm: spin_lock in complete() cleanup Date: Thu, 11 Jul 2013 17:05:25 +0800 Message-Id: <1373533573-12272-3-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=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 Complete() will be run with interrupt enabled, so change to spin_lock_irqsave(). Cc: Oliver Neukum Signed-off-by: Ming Lei --- drivers/usb/class/cdc-wdm.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 8a230f0..5f78d18 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -143,10 +143,12 @@ found: static void wdm_out_callback(struct urb *urb) { struct wdm_device *desc; + unsigned long flags; + desc = urb->context; - spin_lock(&desc->iuspin); + spin_lock_irqsave(&desc->iuspin, flags); desc->werr = urb->status; - spin_unlock(&desc->iuspin); + spin_unlock_irqrestore(&desc->iuspin, flags); kfree(desc->outbuf); desc->outbuf = NULL; clear_bit(WDM_IN_USE, &desc->flags); @@ -158,8 +160,9 @@ static void wdm_in_callback(struct urb *urb) struct wdm_device *desc = urb->context; int status = urb->status; int length = urb->actual_length; + unsigned long flags; - spin_lock(&desc->iuspin); + spin_lock_irqsave(&desc->iuspin, flags); clear_bit(WDM_RESPONDING, &desc->flags); if (status) { @@ -203,7 +206,7 @@ skip_error: wake_up(&desc->wait); set_bit(WDM_READ, &desc->flags); - spin_unlock(&desc->iuspin); + spin_unlock_irqrestore(&desc->iuspin, flags); } static void wdm_int_callback(struct urb *urb) @@ -212,6 +215,7 @@ static void wdm_int_callback(struct urb *urb) int status = urb->status; struct wdm_device *desc; struct usb_cdc_notification *dr; + unsigned long flags; desc = urb->context; dr = (struct usb_cdc_notification *)desc->sbuf; @@ -260,7 +264,7 @@ static void wdm_int_callback(struct urb *urb) goto exit; } - spin_lock(&desc->iuspin); + spin_lock_irqsave(&desc->iuspin, flags); clear_bit(WDM_READ, &desc->flags); set_bit(WDM_RESPONDING, &desc->flags); if (!test_bit(WDM_DISCONNECTING, &desc->flags) @@ -269,7 +273,7 @@ static void wdm_int_callback(struct urb *urb) dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d", __func__, rv); } - spin_unlock(&desc->iuspin); + spin_unlock_irqrestore(&desc->iuspin, flags); if (rv < 0) { clear_bit(WDM_RESPONDING, &desc->flags); if (rv == -EPERM)