From patchwork Wed May 18 18:25:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivo van Doorn X-Patchwork-Id: 794472 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4IIQqsU002429 for ; Wed, 18 May 2011 18:26:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933456Ab1ERS0u (ORCPT ); Wed, 18 May 2011 14:26:50 -0400 Received: from mail-ew0-f46.google.com ([209.85.215.46]:33255 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933455Ab1ERS0t (ORCPT ); Wed, 18 May 2011 14:26:49 -0400 Received: by mail-ew0-f46.google.com with SMTP id 4so526998ewy.19 for ; Wed, 18 May 2011 11:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:message-id:content-type :content-transfer-encoding; bh=mvEEGKtYbMVXjOiZ4AoTGPCfb6ePjnOC7XIrmwliusM=; b=svL14Szda+OjNKJmor1q1WSFlTK0S/6tH75I0zdEoDnfX1G7sLry1aVWq3FYT/NPqk vVc/2yHWnpipXFw4KTgZfrU/rz7gx+Ap9ONFjsrbyApD2oHFzkC0k84ljVdxHdZLw9f5 lu0BnukoigJbk6Lcf6yrTTkpN31H5kBVHIp/c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:message-id:content-type:content-transfer-encoding; b=CUd6VrUvufn2dpT0527uAPt8OIIxvB6X9wg3C92iBpbrjzsv8voFN1LF53piRMvJzm S3DPFNf7JzE8AWYtq3LZKq3AzrgufiqXtPxPk9FDDJnZ9Vl/CFWGLQBg7V80JxRf20uY j7k9LEuu2Tfmj5utAwG64ajigBYWMjzqwncl8= Received: by 10.14.101.14 with SMTP id a14mr278121eeg.55.1305743209231; Wed, 18 May 2011 11:26:49 -0700 (PDT) Received: from localhost.localdomain (g121037.upc-g.chello.nl [80.57.121.37]) by mx.google.com with ESMTPS id 34sm1354242eee.1.2011.05.18.11.26.45 (version=SSLv3 cipher=OTHER); Wed, 18 May 2011 11:26:47 -0700 (PDT) From: Ivo van Doorn To: "John W. Linville" Subject: [PATCH 6/7] rt2x00: Queue index locks don't have to disable IRQs. Date: Wed, 18 May 2011 20:25:56 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.32.26-175.fc12.x86_64; KDE/4.4.5; x86_64; ; ) Cc: linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com References: <201105182022.20341.IvDoorn@gmail.com> <201105182023.25912.IvDoorn@gmail.com> <201105182023.47984.IvDoorn@gmail.com> In-Reply-To: <201105182023.47984.IvDoorn@gmail.com> MIME-Version: 1.0 Message-Id: <201105182025.56724.IvDoorn@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 18 May 2011 18:26:52 +0000 (UTC) From: Gertjan van Wingerde The queue index locks are no longer used in interrupt context due to the introduction of tasklets and workqueues. Therefore we can use a lighter variant of the spinlocks. Signed-off-by: Gertjan van Wingerde Signed-off-by: Ivo van Doorn --- drivers/net/wireless/rt2x00/rt2x00debug.c | 5 ++--- drivers/net/wireless/rt2x00/rt2x00queue.c | 20 ++++++++------------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 78787fc..8e417de 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c @@ -327,7 +327,6 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file, { struct rt2x00debug_intf *intf = file->private_data; struct data_queue *queue; - unsigned long irqflags; unsigned int lines = 1 + intf->rt2x00dev->data_queues; size_t size; char *data; @@ -344,7 +343,7 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file, sprintf(data, "qid\tflags\t\tcount\tlimit\tlength\tindex\tdma done\tdone\n"); queue_for_each(intf->rt2x00dev, queue) { - spin_lock_irqsave(&queue->index_lock, irqflags); + spin_lock_bh(&queue->index_lock); temp += sprintf(temp, "%d\t0x%.8x\t%d\t%d\t%d\t%d\t%d\t\t%d\n", queue->qid, (unsigned int)queue->flags, @@ -353,7 +352,7 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file, queue->index[Q_INDEX_DMA_DONE], queue->index[Q_INDEX_DONE]); - spin_unlock_irqrestore(&queue->index_lock, irqflags); + spin_unlock_bh(&queue->index_lock); } size = strlen(data); diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index f1e1381..e2e1bf6 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c @@ -735,7 +735,6 @@ bool rt2x00queue_for_each_entry(struct data_queue *queue, bool (*fn)(struct queue_entry *entry, void *data)) { - unsigned long irqflags; unsigned int index_start; unsigned int index_end; unsigned int i; @@ -753,10 +752,10 @@ bool rt2x00queue_for_each_entry(struct data_queue *queue, * it should not be kicked during this run, since it * is part of another TX operation. */ - spin_lock_irqsave(&queue->index_lock, irqflags); + spin_lock_bh(&queue->index_lock); index_start = queue->index[start]; index_end = queue->index[end]; - spin_unlock_irqrestore(&queue->index_lock, irqflags); + spin_unlock_bh(&queue->index_lock); /* * Start from the TX done pointer, this guarentees that we will @@ -787,7 +786,6 @@ struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, enum queue_index index) { struct queue_entry *entry; - unsigned long irqflags; if (unlikely(index >= Q_INDEX_MAX)) { ERROR(queue->rt2x00dev, @@ -795,11 +793,11 @@ struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, return NULL; } - spin_lock_irqsave(&queue->index_lock, irqflags); + spin_lock_bh(&queue->index_lock); entry = &queue->entries[queue->index[index]]; - spin_unlock_irqrestore(&queue->index_lock, irqflags); + spin_unlock_bh(&queue->index_lock); return entry; } @@ -808,7 +806,6 @@ EXPORT_SYMBOL_GPL(rt2x00queue_get_entry); void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index) { struct data_queue *queue = entry->queue; - unsigned long irqflags; if (unlikely(index >= Q_INDEX_MAX)) { ERROR(queue->rt2x00dev, @@ -816,7 +813,7 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index) return; } - spin_lock_irqsave(&queue->index_lock, irqflags); + spin_lock_bh(&queue->index_lock); queue->index[index]++; if (queue->index[index] >= queue->limit) @@ -831,7 +828,7 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index) queue->count++; } - spin_unlock_irqrestore(&queue->index_lock, irqflags); + spin_unlock_bh(&queue->index_lock); } void rt2x00queue_pause_queue(struct data_queue *queue) @@ -1031,10 +1028,9 @@ EXPORT_SYMBOL_GPL(rt2x00queue_flush_queues); static void rt2x00queue_reset(struct data_queue *queue) { - unsigned long irqflags; unsigned int i; - spin_lock_irqsave(&queue->index_lock, irqflags); + spin_lock_bh(&queue->index_lock); queue->count = 0; queue->length = 0; @@ -1042,7 +1038,7 @@ static void rt2x00queue_reset(struct data_queue *queue) for (i = 0; i < Q_INDEX_MAX; i++) queue->index[i] = 0; - spin_unlock_irqrestore(&queue->index_lock, irqflags); + spin_unlock_bh(&queue->index_lock); } void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev)