[PATCH 3/3] ar6k: Scan request synchronization

Samuel Ortiz sameo at openedhand.com
Wed Jan 30 01:16:02 CET 2008


Hi Werner,

We now wait for the scan done event before returning from the wireless
extension scan call.
This way we make sure that userspace doesn't ask for scan results before
we actually have them.

Signed-off-by: Samuel Ortiz <sameo at openedhand.com>
---
 drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c   |    7 ++++++-
 drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h   |    1 +
 drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c |    4 ++++
 3 files changed, 11 insertions(+), 1 deletion(-)

Index: linux-2.6.24-rc8-omoko-svn/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h
===================================================================
--- linux-2.6.24-rc8-omoko-svn.orig/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h	2008-01-30 00:46:27.000000000 +0100
+++ linux-2.6.24-rc8-omoko-svn/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.h	2008-01-30 00:46:53.000000000 +0100
@@ -284,6 +284,7 @@
     A_UINT32                log_cnt;
     A_UINT32                dbglog_init_done;
     A_UINT32                arConnectCtrlFlags;
+	A_UINT32                scan_complete;
 #ifdef USER_KEYS
     A_INT32                 user_savedkeys_stat;
     A_UINT32                user_key_ctrl;
Index: linux-2.6.24-rc8-omoko-svn/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c
===================================================================
--- linux-2.6.24-rc8-omoko-svn.orig/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c	2008-01-30 00:46:27.000000000 +0100
+++ linux-2.6.24-rc8-omoko-svn/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c	2008-01-30 00:46:53.000000000 +0100
@@ -199,6 +199,8 @@
 
 int reconnect_flag = 0;
 
+DECLARE_WAIT_QUEUE_HEAD(ar6000_scan_queue);
+
 /* Function declarations */
 static int ar6000_init_module(void);
 static void ar6000_cleanup_module(void);
@@ -2420,7 +2422,10 @@
 void
 ar6000_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status)
 {
-    AR_DEBUG_PRINTF("AR6000 scan complete: %d\n", status);
+	AR_DEBUG_PRINTF("AR6000 scan complete: %d\n", status);
+
+	ar->scan_complete = 1;
+	wake_up_interruptible(&ar6000_scan_queue);
 }
 
 void
Index: linux-2.6.24-rc8-omoko-svn/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c
===================================================================
--- linux-2.6.24-rc8-omoko-svn.orig/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c	2008-01-30 00:47:21.000000000 +0100
+++ linux-2.6.24-rc8-omoko-svn/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c	2008-01-30 00:48:40.000000000 +0100
@@ -23,6 +23,7 @@
 static void ar6000_set_quality(struct iw_quality *iq, A_INT8 rssi);
 extern unsigned int wmitimeout;
 extern A_WAITQUEUE_HEAD arEvent;
+extern wait_queue_head_t ar6000_scan_queue;
 
 #ifdef  __ATH_CENTRAL_IOCTL_DISPATCHER___
 extern int allow_trace_signal;
@@ -1731,6 +1732,9 @@
         ret = -EIO;
     }
 
+    ar->scan_complete = 0;
+    wait_event_interruptible_timeout(ar6000_scan_queue, ar->scan_complete,
+				     5 * HZ);
 
     return ret;
 #undef  ACT_DWELLTIME_DEFAULT





More information about the openmoko-kernel mailing list