From 38bee763bd6d1f77ca3d10639e9bb3f1a1a53443 Mon Sep 17 00:00:00 2001 From: Binoy Jayan Date: Wed, 1 Jun 2016 14:56:56 +0530 Subject: [PATCH] rtl8192e: Replace semaphore ips_sem with mutex The semaphore 'ips_sem' in the rtl8192e is a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 8 ++++---- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 16 ++++++++-------- drivers/staging/rtl8192e/rtllib.h | 3 +-- drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 803c8b02a0c8..30f65af4d614 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -107,9 +107,9 @@ void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex, __func__); return; } - down(&priv->rtllib->ips_sem); + mutex_lock(&priv->rtllib->ips_mutex); rtl92e_ips_leave(dev); - up(&priv->rtllib->ips_sem); + mutex_unlock(&priv->rtllib->ips_mutex); } } priv->rtllib->is_set_key = true; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 98e4d88d0e73..aa4b015c3cc7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -179,9 +179,9 @@ void rtl92e_ips_leave_wq(void *data) struct net_device *dev = ieee->dev; struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); - down(&priv->rtllib->ips_sem); + mutex_lock(&priv->rtllib->ips_mutex); rtl92e_ips_leave(dev); - up(&priv->rtllib->ips_sem); + mutex_unlock(&priv->rtllib->ips_mutex); } void rtl92e_rtllib_ips_leave_wq(struct net_device *dev) @@ -209,9 +209,9 @@ void rtl92e_rtllib_ips_leave(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); - down(&priv->rtllib->ips_sem); + mutex_lock(&priv->rtllib->ips_mutex); rtl92e_ips_leave(dev); - up(&priv->rtllib->ips_sem); + mutex_unlock(&priv->rtllib->ips_mutex); } static bool _rtl92e_ps_set_mode(struct net_device *dev, u8 rtPsMode) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 78fe833c96eb..7413a100ca19 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -281,9 +281,9 @@ static int _rtl92e_wx_set_mode(struct net_device *dev, netdev_info(dev, "=========>%s(): rtl92e_ips_leave\n", __func__); - down(&priv->rtllib->ips_sem); + mutex_lock(&priv->rtllib->ips_mutex); rtl92e_ips_leave(dev); - up(&priv->rtllib->ips_sem); + mutex_unlock(&priv->rtllib->ips_mutex); } } } @@ -442,9 +442,9 @@ static int _rtl92e_wx_set_scan(struct net_device *dev, RT_TRACE(COMP_PS, "=========>%s(): rtl92e_ips_leave\n", __func__); - down(&priv->rtllib->ips_sem); + mutex_lock(&priv->rtllib->ips_mutex); rtl92e_ips_leave(dev); - up(&priv->rtllib->ips_sem); + mutex_unlock(&priv->rtllib->ips_mutex); } } rtllib_stop_scan(priv->rtllib); @@ -698,9 +698,9 @@ static int _rtl92e_wx_set_enc(struct net_device *dev, return -ENETDOWN; priv->rtllib->wx_set_enc = 1; - down(&priv->rtllib->ips_sem); + mutex_lock(&priv->rtllib->ips_mutex); rtl92e_ips_leave(dev); - up(&priv->rtllib->ips_sem); + mutex_unlock(&priv->rtllib->ips_mutex); mutex_lock(&priv->wx_mutex); RT_TRACE(COMP_SEC, "Setting SW wep key"); @@ -905,9 +905,9 @@ static int _rtl92e_wx_set_encode_ext(struct net_device *dev, mutex_lock(&priv->wx_mutex); priv->rtllib->wx_set_enc = 1; - down(&priv->rtllib->ips_sem); + mutex_lock(&priv->rtllib->ips_mutex); rtl92e_ips_leave(dev); - up(&priv->rtllib->ips_sem); + mutex_unlock(&priv->rtllib->ips_mutex); ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra); { diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 5bdc378aabc2..38247fad76f8 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -1654,7 +1653,7 @@ struct rtllib_device { struct mutex wx_mutex; struct mutex scan_mutex; - struct semaphore ips_sem; + struct mutex ips_mutex; spinlock_t mgmt_tx_lock; spinlock_t beacon_lock; diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 858eae20a53f..e84ffc825752 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -3036,7 +3036,7 @@ void rtllib_softmac_init(struct rtllib_device *ieee) mutex_init(&ieee->wx_mutex); mutex_init(&ieee->scan_mutex); - sema_init(&ieee->ips_sem, 1); + mutex_init(&ieee->ips_mutex); spin_lock_init(&ieee->mgmt_tx_lock); spin_lock_init(&ieee->beacon_lock); -- 2.30.2