libertas: test for pending commands directly in get_scan path

Marcelo Tosatti mtosatti at redhat.unroutablecom
Sun Dec 24 04:30:48 EST 2006


Commit:     09fed86c800bd6477444b43ab850c4c34ae33ec5
Parent:     aab5ac286446dcc04d3d5cb14cf7a3a86f116bc7
commit 09fed86c800bd6477444b43ab850c4c34ae33ec5
Author:     Marcelo Tosatti <mtosatti at redhat.com>
AuthorDate: Fri Dec 15 16:57:27 2006 -0200
Commit:     Marcelo Tosatti <mtosatti at redhat.com>
CommitDate: Fri Dec 15 16:57:27 2006 -0200

    libertas: test for pending commands directly in get_scan path
    
    The is_cmd_pending variable can be set if no commands have been issue
    prior to testing. Can result in false -EAGAIN from get_scan, so do the
    test directly from there.
    
    Also set cmd_is_pending to 1 before waiting for response in
    prepare_and_send_command.
    
    Signed-off-by: Marcelo Tosatti <mtosatti at redhat.com>
---
 drivers/net/wireless/libertas/wlan_cmd.c  |    2 +-
 drivers/net/wireless/libertas/wlan_scan.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/libertas/wlan_cmd.c b/drivers/net/wireless/libertas/wlan_cmd.c
index 7dce501..69d98d0 100644
--- a/drivers/net/wireless/libertas/wlan_cmd.c
+++ b/drivers/net/wireless/libertas/wlan_cmd.c
@@ -1751,6 +1751,7 @@ #define ACTION_NUMLED_TLVTYPE_LEN_FIELDS
 	CmdNode->CmdWaitQWoken = 0;
 
 	libertas_queue_cmd(Adapter, CmdNode, 1);
+	Adapter->is_cmd_pending = 1;
 	wake_up_interruptible(&priv->MainThread.waitQ);
 
 	if (wait_option & HostCmd_OPTION_WAITFORRSP) {
@@ -1766,7 +1767,6 @@ #define ACTION_NUMLED_TLVTYPE_LEN_FIELDS
 		Adapter->CurCmdRetCode = 0;
 		ret = WLAN_STATUS_FAILURE;
 	}
-	Adapter->is_cmd_pending = 1;
 	spin_unlock_irqrestore(&Adapter->driver_lock, flags);
 
 done:
diff --git a/drivers/net/wireless/libertas/wlan_scan.c b/drivers/net/wireless/libertas/wlan_scan.c
index 020aa7f..6ffe7c4 100644
--- a/drivers/net/wireless/libertas/wlan_scan.c
+++ b/drivers/net/wireless/libertas/wlan_scan.c
@@ -1606,7 +1606,7 @@ #define RSSI_DIFF    ((u8)(PERFECT_RSSI 
 	 * if there's either commands in the queue or one being 
 	 * processed return -EAGAIN for iwlist to retry later. 
 	 */
-	if (Adapter->is_cmd_pending)
+    if (!Adapter->CurCmd && list_empty(&Adapter->CmdPendingQ))
 		return -EAGAIN;
 
 	if (Adapter->MediaConnectStatus == WlanMediaStateConnected)


More information about the Commits-kernel mailing list