Commit 75deebb4 authored by Binoy Jayan's avatar Binoy Jayan Committed by Greg Kroah-Hartman

rtl8192u: r8192_priv: Replace semaphore wx_sem with mutex

The semaphore 'wx_sem' in r8192_priv is a simple mutex, so
it should be written as one. Semaphores are going away in the future.
Signed-off-by: default avatarBinoy Jayan <binoy.jayan@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ec06d48f
......@@ -879,7 +879,7 @@ typedef struct r8192_priv {
/* If 1, allow bad crc frame, reception in monitor mode */
short crcmon;
struct semaphore wx_sem;
struct mutex wx_mutex;
struct semaphore rf_sem; /* Used to lock rf write operation */
u8 rf_type; /* 0: 1T2R, 1: 2T4R */
......
......@@ -2376,7 +2376,7 @@ static void rtl8192_init_priv_lock(struct r8192_priv *priv)
{
spin_lock_init(&priv->tx_lock);
spin_lock_init(&priv->irq_lock);
sema_init(&priv->wx_sem, 1);
mutex_init(&priv->wx_mutex);
sema_init(&priv->rf_sem, 1);
mutex_init(&priv->mutex);
}
......@@ -3368,12 +3368,12 @@ static void rtl819x_ifsilentreset(struct net_device *dev)
/* Set the variable for reset. */
priv->ResetProgress = RESET_TYPE_SILENT;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
if (priv->up == 0) {
RT_TRACE(COMP_ERR,
"%s():the driver is not up! return\n",
__func__);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return;
}
priv->up = 0;
......@@ -3400,7 +3400,7 @@ static void rtl819x_ifsilentreset(struct net_device *dev)
netdev_dbg(dev, "ieee->state is NOT LINKED\n");
ieee80211_softmac_stop_protocol(priv->ieee80211);
}
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
RT_TRACE(COMP_RESET,
"%s():<==========down process is finished\n",
__func__);
......@@ -3598,9 +3598,9 @@ static int rtl8192_open(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
int ret;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = rtl8192_up(dev);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -3621,11 +3621,11 @@ static int rtl8192_close(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
int ret;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = rtl8192_down(dev);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -3697,11 +3697,11 @@ static void rtl8192_restart(struct work_struct *work)
reset_wq);
struct net_device *dev = priv->ieee80211->dev;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
rtl8192_commit(dev);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
}
static void r8192_set_multicast(struct net_device *dev)
......@@ -3724,12 +3724,12 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac)
struct r8192_priv *priv = ieee80211_priv(dev);
struct sockaddr *addr = mac;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ether_addr_copy(dev->dev_addr, addr->sa_data);
schedule_work(&priv->reset_wq);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return 0;
}
......@@ -3746,7 +3746,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
struct iw_point *p = &wrq->u.data;
struct ieee_param *ipw = NULL;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
if (p->length < sizeof(struct ieee_param) || !p->pointer) {
......@@ -3839,7 +3839,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
kfree(ipw);
ipw = NULL;
out:
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......
......@@ -67,11 +67,11 @@ static int r8192_wx_set_rate(struct net_device *dev,
int ret;
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_rate(priv->ieee80211, info, wrqu, extra);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -83,11 +83,11 @@ static int r8192_wx_set_rts(struct net_device *dev,
int ret;
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_rts(priv->ieee80211, info, wrqu, extra);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -108,11 +108,11 @@ static int r8192_wx_set_power(struct net_device *dev,
int ret;
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_power(priv->ieee80211, info, wrqu, extra);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -132,11 +132,11 @@ static int r8192_wx_force_reset(struct net_device *dev,
{
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
netdev_dbg(dev, "%s(): force reset ! extra is %d\n", __func__, *extra);
priv->force_reset = *extra;
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return 0;
}
......@@ -148,11 +148,11 @@ static int r8192_wx_set_rawtx(struct net_device *dev,
struct r8192_priv *priv = ieee80211_priv(dev);
int ret;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
......@@ -166,7 +166,7 @@ static int r8192_wx_set_crcmon(struct net_device *dev,
int *parms = (int *)extra;
int enable = (parms[0] > 0);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
if (enable)
priv->crcmon = 1;
......@@ -176,7 +176,7 @@ static int r8192_wx_set_crcmon(struct net_device *dev,
DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return 0;
}
......@@ -187,13 +187,13 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
struct r8192_priv *priv = ieee80211_priv(dev);
int ret;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_mode(priv->ieee80211, a, wrqu, b);
rtl8192_set_rxconf(dev);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -338,7 +338,7 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
}
}
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
if (priv->ieee80211->state != IEEE80211_LINKED) {
priv->ieee80211->scanning = 0;
ieee80211_softmac_scan_syncro(priv->ieee80211);
......@@ -346,7 +346,7 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
} else {
ret = ieee80211_wx_set_scan(priv->ieee80211, a, wrqu, b);
}
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -361,11 +361,11 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
if (!priv->up)
return -ENETDOWN;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_get_scan(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -377,11 +377,11 @@ static int r8192_wx_set_essid(struct net_device *dev,
struct r8192_priv *priv = ieee80211_priv(dev);
int ret;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_essid(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -393,11 +393,11 @@ static int r8192_wx_get_essid(struct net_device *dev,
int ret;
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -408,11 +408,11 @@ static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a,
int ret;
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -468,11 +468,11 @@ static int r8192_wx_set_wap(struct net_device *dev,
int ret;
struct r8192_priv *priv = ieee80211_priv(dev);
/* struct sockaddr *temp = (struct sockaddr *)awrq; */
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_wap(priv->ieee80211, info, awrq, extra);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
......@@ -515,12 +515,12 @@ static int r8192_wx_set_enc(struct net_device *dev,
if (!priv->up)
return -ENETDOWN;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
RT_TRACE(COMP_SEC, "Setting SW wep key");
ret = ieee80211_wx_set_encode(priv->ieee80211, info, wrqu, key);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
......@@ -619,7 +619,7 @@ static int r8192_wx_set_retry(struct net_device *dev,
struct r8192_priv *priv = ieee80211_priv(dev);
int err = 0;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
......@@ -652,7 +652,7 @@ static int r8192_wx_set_retry(struct net_device *dev,
rtl8192_commit(dev);
exit:
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return err;
}
......@@ -701,7 +701,7 @@ static int r8192_wx_set_sens(struct net_device *dev,
struct r8192_priv *priv = ieee80211_priv(dev);
short err = 0;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
if (priv->rf_set_sens == NULL) {
err = -1; /* we have not this support for this radio */
goto exit;
......@@ -712,7 +712,7 @@ static int r8192_wx_set_sens(struct net_device *dev,
err = -EINVAL;
exit:
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return err;
}
......@@ -727,7 +727,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
struct ieee80211_device *ieee = priv->ieee80211;
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_encode_ext(priv->ieee80211, info, wrqu, extra);
{
......@@ -790,7 +790,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
end_hw_sec:
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -801,9 +801,9 @@ static int r8192_wx_set_auth(struct net_device *dev,
int ret = 0;
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -815,10 +815,10 @@ static int r8192_wx_set_mlme(struct net_device *dev,
int ret = 0;
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
}
......@@ -829,9 +829,9 @@ static int r8192_wx_set_gen_ie(struct net_device *dev,
int ret = 0;
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
mutex_lock(&priv->wx_mutex);
ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length);
up(&priv->wx_sem);
mutex_unlock(&priv->wx_mutex);
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment