From patchwork Thu Jul 11 09:05:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2826180 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 CEFF19F7D6 for ; Thu, 11 Jul 2013 09:17:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A511E200E0 for ; Thu, 11 Jul 2013 09:17:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F1E120121 for ; Thu, 11 Jul 2013 09:17:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932606Ab3GKJQi (ORCPT ); Thu, 11 Jul 2013 05:16:38 -0400 Received: from mail-pb0-f47.google.com ([209.85.160.47]:34957 "EHLO mail-pb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932245Ab3GKJJn (ORCPT ); Thu, 11 Jul 2013 05:09:43 -0400 Received: by mail-pb0-f47.google.com with SMTP id rr13so7683052pbb.34 for ; Thu, 11 Jul 2013 02:09:42 -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=lcJlTyKyStlW6RTOErfKvNBS3tsTCAmGgWdLKm//B34=; b=dsBXSaMfaXaM9enDbMs7d6P+jPEJ9i+i/U6KxIUcQWnXURXwVAvJDjAZY2l2p5PHJ/ imOGQmoUnyzAhEwnThfZjrzUjOxvcp0k2BkNbFC+TzCEiq04XaZv7Cz1yjfuK08712qB yw7f0dIIo6Jq6KPje+1sz/U1kZefGQpAGnmMlybxe9pJkQ3dfNGtA/d5FrgjWRI+ycB0 WNQZfy9f7/LqCQELowWzaX3iaLeF6QnKmN+OuXxXXmmKjMm2Y/Y70fLhKGlHJnasyINo nYm3YeYcfaAzqaZki5y9kZE7E3waHlugraczzDNsxT6Q+Y69r7n54CpkBqFIsGeDlMsN rxyg== X-Received: by 10.66.27.114 with SMTP id s18mr36953522pag.98.1373533782252; Thu, 11 Jul 2013 02:09:42 -0700 (PDT) Received: from localhost ([183.37.203.123]) by mx.google.com with ESMTPSA id eg3sm41105873pac.1.2013.07.11.02.09.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 11 Jul 2013 02:09:41 -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 , Marcel Holtmann , Gustavo Padovan , Johan Hedberg Subject: [PATCH 23/50] BT: bfusb: read_lock in complete() cleanup Date: Thu, 11 Jul 2013 17:05:46 +0800 Message-Id: <1373533573-12272-24-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 read_lock_irqsave(). Cc: Marcel Holtmann Cc: Gustavo Padovan Cc: Johan Hedberg Cc: linux-bluetooth@vger.kernel.org Signed-off-by: Ming Lei --- drivers/bluetooth/bfusb.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 995aee9..2e93501 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -186,6 +186,7 @@ static void bfusb_tx_complete(struct urb *urb) { struct sk_buff *skb = (struct sk_buff *) urb->context; struct bfusb_data *data = (struct bfusb_data *) skb->dev; + unsigned long flags; BT_DBG("bfusb %p urb %p skb %p len %d", data, urb, skb, skb->len); @@ -199,14 +200,14 @@ static void bfusb_tx_complete(struct urb *urb) else data->hdev->stat.err_tx++; - read_lock(&data->lock); + read_lock_irqsave(&data->lock, flags); skb_unlink(skb, &data->pending_q); skb_queue_tail(&data->completed_q, skb); bfusb_tx_wakeup(data); - read_unlock(&data->lock); + read_unlock_irqrestore(&data->lock, flags); } @@ -347,10 +348,11 @@ static void bfusb_rx_complete(struct urb *urb) unsigned char *buf = urb->transfer_buffer; int count = urb->actual_length; int err, hdr, len; + unsigned long flags; BT_DBG("bfusb %p urb %p skb %p len %d", data, urb, skb, skb->len); - read_lock(&data->lock); + read_lock_irqsave(&data->lock, flags); if (!test_bit(HCI_RUNNING, &data->hdev->flags)) goto unlock; @@ -392,7 +394,7 @@ static void bfusb_rx_complete(struct urb *urb) bfusb_rx_submit(data, urb); - read_unlock(&data->lock); + read_unlock_irqrestore(&data->lock, flags); return; @@ -406,7 +408,7 @@ resubmit: } unlock: - read_unlock(&data->lock); + read_unlock_irqrestore(&data->lock, flags); } static int bfusb_open(struct hci_dev *hdev)