From patchwork Thu Jul 11 09:05:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2826214 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 276AEC0AB2 for ; Thu, 11 Jul 2013 09:18:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B4CC200E0 for ; Thu, 11 Jul 2013 09:18:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2992B20121 for ; Thu, 11 Jul 2013 09:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932125Ab3GKJHz (ORCPT ); Thu, 11 Jul 2013 05:07:55 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:51414 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932090Ab3GKJHv (ORCPT ); Thu, 11 Jul 2013 05:07:51 -0400 Received: by mail-pa0-f47.google.com with SMTP id kl14so7646116pab.6 for ; Thu, 11 Jul 2013 02:07:50 -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=Ip1EN1DAhrntN7xT14wHitvqeQpllKJH3ielfKW3N7w=; b=jRxMN2KBQuvROQmsFpFlxXYz5LnQ1LkpVMC1ZI8I/yx6ThT+K3ObpEaAf7m0MfAba4 WRf0Yi7/knyHeGkUCgJQhR0gbdHhfJCxq/2Bm1Sg9o7E7ghDOXezeZYrnM2e93XDBBOn DjfARm0W7fqlyQ/RNPgcW363VPbZL+XghWwCr7Kh02SJnBSCMQswq8SaWhUs4CF3QH0w aOAr2M6MRpZ+iB/XVGvSb2i1mhpls+TcXKg6lISokc+eZTeBTMy0uUAfvtvZ4iLo7OuE fRymIPO9yvy2RXN8EVZlOKmMe0YbwsJJtS64ZrEklZx8x13ajtSfx0VzioCf5FAeeOvp y+Sg== X-Received: by 10.66.2.164 with SMTP id 4mr37595392pav.55.1373533670340; Thu, 11 Jul 2013 02:07:50 -0700 (PDT) Received: from localhost ([183.37.203.123]) by mx.google.com with ESMTPSA id vb8sm38652656pbc.11.2013.07.11.02.07.46 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 11 Jul 2013 02:07:49 -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 09/50] USB: usbtest: spin_lock in complete() cleanup Date: Thu, 11 Jul 2013 17:05:32 +0800 Message-Id: <1373533573-12272-10-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(). Signed-off-by: Ming Lei --- drivers/usb/misc/usbtest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 8b4ca1c..5c73df5 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -804,11 +804,12 @@ static void ctrl_complete(struct urb *urb) struct usb_ctrlrequest *reqp; struct subcase *subcase; int status = urb->status; + unsigned long flags; reqp = (struct usb_ctrlrequest *)urb->setup_packet; subcase = container_of(reqp, struct subcase, setup); - spin_lock(&ctx->lock); + spin_lock_irqsave(&ctx->lock, flags); ctx->count--; ctx->pending--; @@ -907,7 +908,7 @@ error: /* signal completion when nothing's queued */ if (ctx->pending == 0) complete(&ctx->complete); - spin_unlock(&ctx->lock); + spin_unlock_irqrestore(&ctx->lock, flags); } static int @@ -1552,8 +1553,9 @@ struct iso_context { static void iso_callback(struct urb *urb) { struct iso_context *ctx = urb->context; + unsigned long flags; - spin_lock(&ctx->lock); + spin_lock_irqsave(&ctx->lock, flags); ctx->count--; ctx->packet_count += urb->number_of_packets; @@ -1593,7 +1595,7 @@ static void iso_callback(struct urb *urb) complete(&ctx->done); } done: - spin_unlock(&ctx->lock); + spin_unlock_irqrestore(&ctx->lock, flags); } static struct urb *iso_alloc_urb(