Commit 857c440a authored by Marcelo Tosatti's avatar Marcelo Tosatti Committed by Greg Kroah-Hartman

libertas: properly account for queue commands

patch 29f5f2a1 in mainline.

Properly account for queue commands, this fixes a problem reported
by Holger Schurig when using the debugfs interface.
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8996d0af
...@@ -881,6 +881,10 @@ static int wlan_cmd_mesh_access(wlan_private * priv, ...@@ -881,6 +881,10 @@ static int wlan_cmd_mesh_access(wlan_private * priv,
return 0; 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) void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail)
{ {
unsigned long flags; unsigned long flags;
...@@ -910,10 +914,11 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u ...@@ -910,10 +914,11 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
spin_lock_irqsave(&adapter->driver_lock, flags); spin_lock_irqsave(&adapter->driver_lock, flags);
if (addtail) if (addtail) {
list_add_tail((struct list_head *)cmdnode, list_add_tail((struct list_head *)cmdnode,
&adapter->cmdpendingq); &adapter->cmdpendingq);
else adapter->nr_cmd_pending++;
} else
list_add((struct list_head *)cmdnode, &adapter->cmdpendingq); list_add((struct list_head *)cmdnode, &adapter->cmdpendingq);
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
...@@ -1400,7 +1405,6 @@ int libertas_prepare_and_send_command(wlan_private * priv, ...@@ -1400,7 +1405,6 @@ int libertas_prepare_and_send_command(wlan_private * priv,
cmdnode->cmdwaitqwoken = 0; cmdnode->cmdwaitqwoken = 0;
libertas_queue_cmd(adapter, cmdnode, 1); libertas_queue_cmd(adapter, cmdnode, 1);
adapter->nr_cmd_pending++;
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
if (wait_option & cmd_option_waitforrsp) { if (wait_option & cmd_option_waitforrsp) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment