Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1661031 > unrolled thread

[PATCH] mwifiex: Replace semaphore async_sem with mutex

Started byBinoy Jayan <binoy.jayan@linaro.org>
First post2017-06-08 12:10 +0200
Last post2017-06-13 09:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mwifiex: Replace semaphore async_sem with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-08 12:10 +0200
    Re: [PATCH] mwifiex: Replace semaphore async_sem with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-08 17:00 +0200
    Re: mwifiex: Replace semaphore async_sem with mutex Kalle Valo <kvalo@codeaurora.org> - 2017-06-13 09:10 +0200

#1661031 — [PATCH] mwifiex: Replace semaphore async_sem with mutex

FromBinoy Jayan <binoy.jayan@linaro.org>
Date2017-06-08 12:10 +0200
Subject[PATCH] mwifiex: Replace semaphore async_sem with mutex
Message-ID<tQ2y6-2WM-33@gated-at.bofh.it>
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>
---

This patch is part of a bigger effort to eliminate unwanted
semaphores from the linux kernel.

 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +-
 drivers/net/wireless/marvell/mwifiex/main.h     | 2 +-
 drivers/net/wireless/marvell/mwifiex/scan.c     | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 7ec06bf..9e0d638 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3059,7 +3059,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);
 
 	mwifiex_dbg(adapter, INFO,
 		    "info: %s: Marvell 802.11 Adapter\n", dev->name);
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index bb2a467..9c2cb33 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -628,7 +628,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;
diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index ce6936d..ae9630b 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -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;
 }
-- 
Binoy Jayan

[toc] | [next] | [standalone]


#1661355

FromArnd Bergmann <arnd@arndb.de>
Date2017-06-08 17:00 +0200
Message-ID<tQ74K-5AT-9@gated-at.bofh.it>
In reply to#1661031
On Thu, Jun 8, 2017 at 12:03 PM, Binoy Jayan <binoy.jayan@linaro.org> wrote:
> 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>
> ---
>
> This patch is part of a bigger effort to eliminate unwanted
> semaphores from the linux kernel.

Looks good,

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

[toc] | [prev] | [next] | [standalone]


#1664519 — Re: mwifiex: Replace semaphore async_sem with mutex

FromKalle Valo <kvalo@codeaurora.org>
Date2017-06-13 09:10 +0200
SubjectRe: mwifiex: Replace semaphore async_sem with mutex
Message-ID<tRO7D-4US-7@gated-at.bofh.it>
In reply to#1661031
Binoy Jayan <binoy.jayan@linaro.org> wrote:

> 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>

Patch applied to wireless-drivers-next.git, thanks.

1abf9ae719f6 mwifiex: Replace semaphore async_sem with mutex

-- 
https://patchwork.kernel.org/patch/9774361/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web