mwifiex: minor cleanup and a fix in scan semaphore usage
authorAmitkumar Karwar <akarwar@marvell.com>
Sat, 20 Oct 2012 02:19:17 +0000 (19:19 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 29 Oct 2012 19:20:33 +0000 (15:20 -0400)
mwifiex_request_scan() takes care of synchronous internal scan
performed by driver during association.
Currently the semaphore acquired for the scan is unnecessarily
released at the end of different paths. Also, failure paths
returning error code other than "-1" are not considered.

We will release it at the end of routine to fix above issues.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/init.c
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/scan.c
drivers/net/wireless/mwifiex/sta_cmdresp.c

index 0a067bd0222f928c72e9ee79825898b15ed79260..94405831a8707489f22c16b1faf0fbb5f6d597e4 100644 (file)
@@ -2119,7 +2119,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
        }
 
        sema_init(&priv->async_sem, 1);
-       priv->scan_pending_on_block = false;
 
        dev_dbg(adapter->dev, "info: %s: Marvell 802.11 Adapter\n", dev->name);
 
index 37f2d957bbf02f508f68e7bad8dd654ab9db6315..482faace79005caf4c01b21de5794f2493c72445 100644 (file)
@@ -97,11 +97,6 @@ static void scan_delay_timer_fn(unsigned long data)
                        kfree(priv->user_scan_cfg);
                        priv->user_scan_cfg = NULL;
                }
-
-               if (priv->scan_pending_on_block) {
-                       priv->scan_pending_on_block = false;
-                       up(&priv->async_sem);
-               }
                goto done;
        }
 
index 0b747ec84c4df9c19200170d90e8e45ac563c73a..4ed46b694ced209d7535bf65f3886fa05b47325b 100644 (file)
@@ -482,7 +482,6 @@ struct mwifiex_private {
        u8 nick_name[16];
        u16 current_key_index;
        struct semaphore async_sem;
-       u8 scan_pending_on_block;
        u8 report_scan_result;
        struct cfg80211_scan_request *scan_request;
        struct mwifiex_user_scan_cfg *user_scan_cfg;
index 32b79ddd774bbea37308b77031d1ebb8a3c5a16a..9c0ad0fe276a12aa7a0164d4061d15cb9fee5bda 100644 (file)
@@ -1762,10 +1762,6 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
                }
                if (priv->report_scan_result)
                        priv->report_scan_result = false;
-               if (priv->scan_pending_on_block) {
-                       priv->scan_pending_on_block = false;
-                       up(&priv->async_sem);
-               }
 
                if (priv->user_scan_cfg) {
                        if (priv->scan_request) {
@@ -1914,7 +1910,6 @@ int mwifiex_request_scan(struct mwifiex_private *priv,
                        __func__);
                return -1;
        }
-       priv->scan_pending_on_block = true;
 
        priv->adapter->scan_wait_q_woken = false;
 
@@ -1928,10 +1923,7 @@ int mwifiex_request_scan(struct mwifiex_private *priv,
        if (!ret)
                ret = mwifiex_wait_queue_complete(priv->adapter);
 
-       if (ret == -1) {
-               priv->scan_pending_on_block = false;
-               up(&priv->async_sem);
-       }
+       up(&priv->async_sem);
 
        return ret;
 }
index 09e6a267f5666fd0bf868bd537635726239e4680..65c12eb3e5e73ba8085dd6e57c332b5ca6e28a80 100644 (file)
@@ -85,10 +85,6 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
                spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
                if (priv->report_scan_result)
                        priv->report_scan_result = false;
-               if (priv->scan_pending_on_block) {
-                       priv->scan_pending_on_block = false;
-                       up(&priv->async_sem);
-               }
                break;
 
        case HostCmd_CMD_MAC_CONTROL: