mwifiex: Replace semaphore async_sem with mutex
authorBinoy Jayan <binoy.jayan@linaro.org>
Thu, 8 Jun 2017 10:03:03 +0000 (15:33 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 13 Jun 2017 07:05:05 +0000 (10:05 +0300)
The semaphore 'async_sem' is used as a simple mutex, so
it should be written as one. Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/cfg80211.c
drivers/net/wireless/marvell/mwifiex/main.h
drivers/net/wireless/marvell/mwifiex/scan.c

index 025bc06a19d66ef03101e8e8d2079d1ede2da8b9..feb2ce3082d8800c446f9a1f17847f6540145793 100644 (file)
@@ -3033,7 +3033,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
        INIT_DELAYED_WORK(&priv->dfs_chan_sw_work,
                          mwifiex_dfs_chan_sw_work_queue);
 
-       sema_init(&priv->async_sem, 1);
+       mutex_init(&priv->async_mutex);
 
        /* Register network device */
        if (register_netdevice(dev)) {
index c37fb260650260387554108fd90607c0f083ffee..f8cf3079ac7dff01fce20834b9e2b2909cbe1899 100644 (file)
@@ -629,7 +629,7 @@ struct mwifiex_private {
        struct dentry *dfs_dev_dir;
 #endif
        u16 current_key_index;
-       struct semaphore async_sem;
+       struct mutex async_mutex;
        struct cfg80211_scan_request *scan_request;
        u8 cfg_bssid[6];
        struct wps wps;
index ce6936d0c5c02ee4a64e5bcb5a13e11188adf07f..ae9630b493420f8ea9af78e2ef7a715eb799a2b2 100644 (file)
@@ -2809,7 +2809,7 @@ int mwifiex_request_scan(struct mwifiex_private *priv,
 {
        int ret;
 
-       if (down_interruptible(&priv->async_sem)) {
+       if (mutex_lock_interruptible(&priv->async_mutex)) {
                mwifiex_dbg(priv->adapter, ERROR,
                            "%s: acquire semaphore fail\n",
                            __func__);
@@ -2825,7 +2825,7 @@ int mwifiex_request_scan(struct mwifiex_private *priv,
                /* Normal scan */
                ret = mwifiex_scan_networks(priv, NULL);
 
-       up(&priv->async_sem);
+       mutex_unlock(&priv->async_mutex);
 
        return ret;
 }