mwifiex: process event before command response
authorAmitkumar Karwar <akarwar@marvell.com>
Mon, 14 Apr 2014 22:31:05 +0000 (15:31 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 15 Apr 2014 17:27:05 +0000 (13:27 -0400)
During extended scan, SCAN report event is always followed by
command response. Sometimes It is observed that command response
is processed before SCAN report which leads to a crash, because
current command node is cleared while handling the response.
This patch makes sure that driver's main thread gives priority
to events over command responses.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Maithili Hinge <maithili@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/main.c

index 77db0886c6e2e9fa764f2a0add8876b477972915..9c771b3e99186ffe838f771b217216ebc5a43454 100644 (file)
@@ -292,6 +292,12 @@ process_start:
                        while ((skb = skb_dequeue(&adapter->usb_rx_data_q)))
                                mwifiex_handle_rx_packet(adapter, skb);
 
+               /* Check for event */
+               if (adapter->event_received) {
+                       adapter->event_received = false;
+                       mwifiex_process_event(adapter);
+               }
+
                /* Check for Cmd Resp */
                if (adapter->cmd_resp_received) {
                        adapter->cmd_resp_received = false;
@@ -304,12 +310,6 @@ process_start:
                        }
                }
 
-               /* Check for event */
-               if (adapter->event_received) {
-                       adapter->event_received = false;
-                       mwifiex_process_event(adapter);
-               }
-
                /* Check if we need to confirm Sleep Request
                   received previously */
                if (adapter->ps_state == PS_STATE_PRE_SLEEP) {