From patchwork Thu Jul 11 09:05:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2826075 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 54C7EC0AB2 for ; Thu, 11 Jul 2013 09:07:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2135F2011B for ; Thu, 11 Jul 2013 09:07:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06512200B9 for ; Thu, 11 Jul 2013 09:07:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932099Ab3GKJHg (ORCPT ); Thu, 11 Jul 2013 05:07:36 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:36255 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932090Ab3GKJHb (ORCPT ); Thu, 11 Jul 2013 05:07:31 -0400 Received: by mail-pa0-f45.google.com with SMTP id bi5so7609669pad.18 for ; Thu, 11 Jul 2013 02:07:30 -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=KRow3nnvbJPaP8OpjQ0NB6fYXHK7io7RY5MfelSRHD4=; b=hLznhklo8ZRv5aF13g12W2rXJTQuaLrOOThfsFRLHhXoFr6c61yNankXTKpCLrH2MM xYk5/cS569MolmzlRE3vNpPDHAicLlelf6vwzbWZmC6PoLTWMrmFvuw04mq+e+o/y1P5 JQjgkGWFMRYa2CxFMMuSrzXALF4Odf093sWm0g95fAbWV/OogLG3vaZKxonmb2lIrSwq 6zg8zxRAUc/aTrVQlz7NQYevKj7ioKsDTjbLEXuQJlMnEkv45IHqB5Z306AMHF+cm6/t 9CPHH4FXyyrgoFZsK6F301oqR2r3F/NHS8ypJ8fVGc8Ly11DRuQYpFAuf6nJ/tmGjLOx nmVw== X-Received: by 10.68.224.66 with SMTP id ra2mr3557040pbc.41.1373533650474; Thu, 11 Jul 2013 02:07:30 -0700 (PDT) Received: from localhost ([183.37.203.123]) by mx.google.com with ESMTPSA id iq6sm38664527pbc.1.2013.07.11.02.07.25 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 11 Jul 2013 02:07:29 -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 07/50] USB: ldusb: spin_lock in complete() cleanup Date: Thu, 11 Jul 2013 17:05:30 +0800 Message-Id: <1373533573-12272-8-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(). Signed-off-by: Ming Lei --- drivers/usb/misc/ldusb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index ac76229..8bae18e 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -249,6 +249,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) unsigned int next_ring_head; int status = urb->status; int retval; + unsigned long flags; if (status) { if (status == -ENOENT || @@ -258,12 +259,12 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) } else { dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n", __func__, status); - spin_lock(&dev->rbsl); + spin_lock_irqsave(&dev->rbsl, flags); goto resubmit; /* maybe we can recover */ } } - spin_lock(&dev->rbsl); + spin_lock_irqsave(&dev->rbsl, flags); if (urb->actual_length > 0) { next_ring_head = (dev->ring_head+1) % ring_buffer_size; if (next_ring_head != dev->ring_tail) { @@ -292,7 +293,7 @@ resubmit: dev->buffer_overflow = 1; } } - spin_unlock(&dev->rbsl); + spin_unlock_irqrestore(&dev->rbsl, flags); exit: dev->interrupt_in_done = 1; wake_up_interruptible(&dev->read_wait);