blob: 577b082be4241174d01df436b49bea2e9107af2b [file] [log] [blame]
From stable-bounces@linux.kernel.org Tue Nov 20 10:55:25 2007
From: Marcelo Tosatti <marcelo@kvack.org>
Date: Tue, 20 Nov 2007 13:54:52 -0500
Subject: libertas: properly account for queue commands
To: stable@kernel.org
Cc: Marcelo Tosatti <marcelo@kvack.org>, Marcelo Tosatti <mtosatti@redhat.com>, "John W. Linville" <linville@tuxdriver.com>
Message-ID: <1195584892-2864-1-git-send-email-linville@tuxdriver.com>
From: Marcelo Tosatti <marcelo@kvack.org>
patch 29f5f2a19b055feabfcc6f92e1d40ec092c373ea in mainline.
Properly account for queue commands, this fixes a problem reported
by Holger Schurig when using the debugfs interface.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/net/wireless/libertas/cmd.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -881,6 +881,10 @@ static int wlan_cmd_mesh_access(wlan_pri
return 0;
}
+/*
+ * Note: NEVER use libertas_queue_cmd() with addtail==0 other than for
+ * the command timer, because it does not account for queued commands.
+ */
void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail)
{
unsigned long flags;
@@ -910,10 +914,11 @@ void libertas_queue_cmd(wlan_adapter * a
spin_lock_irqsave(&adapter->driver_lock, flags);
- if (addtail)
+ if (addtail) {
list_add_tail((struct list_head *)cmdnode,
&adapter->cmdpendingq);
- else
+ adapter->nr_cmd_pending++;
+ } else
list_add((struct list_head *)cmdnode, &adapter->cmdpendingq);
spin_unlock_irqrestore(&adapter->driver_lock, flags);
@@ -1400,7 +1405,6 @@ int libertas_prepare_and_send_command(wl
cmdnode->cmdwaitqwoken = 0;
libertas_queue_cmd(adapter, cmdnode, 1);
- adapter->nr_cmd_pending++;
wake_up_interruptible(&priv->mainthread.waitq);
if (wait_option & cmd_option_waitforrsp) {