rtl8192u: ieee80211_device: Replace semaphore wx_sem with mutex

The semaphore 'wx_sem' in ieee80211_device is 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Binoy Jayan 2016-06-02 16:23:00 +05:30 committed by Greg Kroah-Hartman
parent 75deebb42d
commit e379a9a879
5 changed files with 41 additions and 41 deletions

View File

@ -1799,7 +1799,7 @@ struct ieee80211_device {
short scanning; short scanning;
short proto_started; short proto_started;
struct semaphore wx_sem; struct mutex wx_mutex;
struct semaphore scan_sem; struct semaphore scan_sem;
spinlock_t mgmt_tx_lock; spinlock_t mgmt_tx_lock;

View File

@ -621,7 +621,7 @@ static void ieee80211_start_scan(struct ieee80211_device *ieee)
} }
/* called with wx_sem held */ /* called with wx_mutex held */
void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
{ {
if (IS_DOT11D_ENABLE(ieee) ) if (IS_DOT11D_ENABLE(ieee) )
@ -1389,7 +1389,7 @@ static void ieee80211_associate_procedure_wq(struct work_struct *work)
{ {
struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
ieee->sync_scan_hurryup = 1; ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
if (ieee->data_hard_stop) if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev); ieee->data_hard_stop(ieee->dev);
@ -1402,7 +1402,7 @@ static void ieee80211_associate_procedure_wq(struct work_struct *work)
ieee->associate_seq = 1; ieee->associate_seq = 1;
ieee80211_associate_step1(ieee); ieee80211_associate_step1(ieee);
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
} }
inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net) inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
@ -2331,7 +2331,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work)
struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq);
/* iwconfig mode ad-hoc will schedule this and return /* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET * on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold. * operations because of the wx_mutex hold.
* Anyway some most set operations set a flag to speed-up * Anyway some most set operations set a flag to speed-up
* (abort) this wq (when syncro scanning) before sleeping * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore * on the semaphore
@ -2340,7 +2340,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work)
printk("==========oh driver down return\n"); printk("==========oh driver down return\n");
return; return;
} }
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
if (ieee->current_network.ssid_len == 0) { if (ieee->current_network.ssid_len == 0) {
strcpy(ieee->current_network.ssid, IEEE80211_DEFAULT_TX_ESSID); strcpy(ieee->current_network.ssid, IEEE80211_DEFAULT_TX_ESSID);
@ -2431,7 +2431,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work)
ieee->data_hard_resume(ieee->dev); ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev); netif_carrier_on(ieee->dev);
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
} }
inline void ieee80211_start_ibss(struct ieee80211_device *ieee) inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
@ -2439,7 +2439,7 @@ inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
schedule_delayed_work(&ieee->start_ibss_wq, 150); schedule_delayed_work(&ieee->start_ibss_wq, 150);
} }
/* this is called only in user context, with wx_sem held */ /* this is called only in user context, with wx_mutex held */
void ieee80211_start_bss(struct ieee80211_device *ieee) void ieee80211_start_bss(struct ieee80211_device *ieee)
{ {
unsigned long flags; unsigned long flags;
@ -2505,7 +2505,7 @@ static void ieee80211_associate_retry_wq(struct work_struct *work)
struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
unsigned long flags; unsigned long flags;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
if(!ieee->proto_started) if(!ieee->proto_started)
goto exit; goto exit;
@ -2537,7 +2537,7 @@ static void ieee80211_associate_retry_wq(struct work_struct *work)
spin_unlock_irqrestore(&ieee->lock, flags); spin_unlock_irqrestore(&ieee->lock, flags);
exit: exit:
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
} }
struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee) struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
@ -2583,9 +2583,9 @@ EXPORT_SYMBOL(ieee80211_get_beacon);
void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee) void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
{ {
ieee->sync_scan_hurryup = 1; ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
ieee80211_stop_protocol(ieee); ieee80211_stop_protocol(ieee);
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
} }
EXPORT_SYMBOL(ieee80211_softmac_stop_protocol); EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
@ -2609,9 +2609,9 @@ void ieee80211_stop_protocol(struct ieee80211_device *ieee)
void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee) void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
{ {
ieee->sync_scan_hurryup = 0; ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
ieee80211_start_protocol(ieee); ieee80211_start_protocol(ieee);
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
} }
EXPORT_SYMBOL(ieee80211_softmac_start_protocol); EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
@ -2728,7 +2728,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq); INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq);
sema_init(&ieee->wx_sem, 1); mutex_init(&ieee->wx_mutex);
sema_init(&ieee->scan_sem, 1); sema_init(&ieee->scan_sem, 1);
spin_lock_init(&ieee->mgmt_tx_lock); spin_lock_init(&ieee->mgmt_tx_lock);
@ -2742,14 +2742,14 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
void ieee80211_softmac_free(struct ieee80211_device *ieee) void ieee80211_softmac_free(struct ieee80211_device *ieee)
{ {
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
kfree(ieee->pDot11dInfo); kfree(ieee->pDot11dInfo);
ieee->pDot11dInfo = NULL; ieee->pDot11dInfo = NULL;
del_timer_sync(&ieee->associate_timer); del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq); cancel_delayed_work(&ieee->associate_retry_wq);
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
} }
/******************************************************** /********************************************************
@ -3138,7 +3138,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
struct ieee_param *param; struct ieee_param *param;
int ret=0; int ret=0;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
//IEEE_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); //IEEE_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length);
if (p->length < sizeof(struct ieee_param) || !p->pointer) { if (p->length < sizeof(struct ieee_param) || !p->pointer) {
@ -3183,7 +3183,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
kfree(param); kfree(param);
out: out:
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
return ret; return ret;
} }

View File

@ -34,7 +34,7 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info
int ret; int ret;
struct iw_freq *fwrq = &wrqu->freq; struct iw_freq *fwrq = &wrqu->freq;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
if (ieee->iw_mode == IW_MODE_INFRA) { if (ieee->iw_mode == IW_MODE_INFRA) {
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
@ -79,7 +79,7 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info
ret = 0; ret = 0;
out: out:
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
return ret; return ret;
} }
EXPORT_SYMBOL(ieee80211_wx_set_freq); EXPORT_SYMBOL(ieee80211_wx_set_freq);
@ -145,7 +145,7 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
ieee->sync_scan_hurryup = 1; ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
/* use ifconfig hw ether */ /* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER) { if (ieee->iw_mode == IW_MODE_MASTER) {
ret = -1; ret = -1;
@ -173,7 +173,7 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
if (ifup) if (ifup)
ieee80211_start_protocol(ieee); ieee80211_start_protocol(ieee);
out: out:
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
return ret; return ret;
} }
EXPORT_SYMBOL(ieee80211_wx_set_wap); EXPORT_SYMBOL(ieee80211_wx_set_wap);
@ -274,7 +274,7 @@ int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info
ieee->sync_scan_hurryup = 1; ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
if (wrqu->mode == ieee->iw_mode) if (wrqu->mode == ieee->iw_mode)
goto out; goto out;
@ -293,7 +293,7 @@ int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info
} }
out: out:
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
return 0; return 0;
} }
EXPORT_SYMBOL(ieee80211_wx_set_mode); EXPORT_SYMBOL(ieee80211_wx_set_mode);
@ -353,7 +353,7 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work)
ieee80211_start_send_beacons(ieee); ieee80211_start_send_beacons(ieee);
netif_carrier_on(ieee->dev); netif_carrier_on(ieee->dev);
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
} }
@ -362,7 +362,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info
{ {
int ret = 0; int ret = 0;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)) { if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)) {
ret = -1; ret = -1;
@ -376,7 +376,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info
} }
out: out:
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
return ret; return ret;
} }
EXPORT_SYMBOL(ieee80211_wx_set_scan); EXPORT_SYMBOL(ieee80211_wx_set_scan);
@ -391,7 +391,7 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
unsigned long flags; unsigned long flags;
ieee->sync_scan_hurryup = 1; ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
proto_started = ieee->proto_started; proto_started = ieee->proto_started;
@ -430,7 +430,7 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
if (proto_started) if (proto_started)
ieee80211_start_protocol(ieee); ieee80211_start_protocol(ieee);
out: out:
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
return ret; return ret;
} }
EXPORT_SYMBOL(ieee80211_wx_set_essid); EXPORT_SYMBOL(ieee80211_wx_set_essid);
@ -453,7 +453,7 @@ int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
int enable = (parms[0] > 0); int enable = (parms[0] > 0);
short prev = ieee->raw_tx; short prev = ieee->raw_tx;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
if (enable) if (enable)
ieee->raw_tx = 1; ieee->raw_tx = 1;
@ -475,7 +475,7 @@ int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
netif_carrier_off(ieee->dev); netif_carrier_off(ieee->dev);
} }
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
return 0; return 0;
} }
@ -514,7 +514,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee,
{ {
int ret = 0; int ret = 0;
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
if (wrqu->power.disabled) { if (wrqu->power.disabled) {
ieee->ps = IEEE80211_PS_DISABLED; ieee->ps = IEEE80211_PS_DISABLED;
@ -553,7 +553,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee,
} }
exit: exit:
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
return ret; return ret;
} }
@ -564,7 +564,7 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
if (ieee->ps == IEEE80211_PS_DISABLED) { if (ieee->ps == IEEE80211_PS_DISABLED) {
wrqu->power.disabled = 1; wrqu->power.disabled = 1;
@ -592,7 +592,7 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee,
wrqu->power.flags |= IW_POWER_UNICAST_R; wrqu->power.flags |= IW_POWER_UNICAST_R;
exit: exit:
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
return 0; return 0;
} }

View File

@ -253,7 +253,7 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
int i = 0; int i = 0;
int err = 0; int err = 0;
IEEE80211_DEBUG_WX("Getting scan\n"); IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
spin_lock_irqsave(&ieee->lock, flags); spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) { list_for_each_entry(network, &ieee->network_list, list) {
@ -262,7 +262,7 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
{ {
err = -E2BIG; err = -E2BIG;
break; break;
} }
if (ieee->scan_age == 0 || if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies)) time_after(network->last_scanned + ieee->scan_age, jiffies))
ev = rtl819x_translate_scan(ieee, ev, stop, network, info); ev = rtl819x_translate_scan(ieee, ev, stop, network, info);
@ -277,7 +277,7 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
} }
spin_unlock_irqrestore(&ieee->lock, flags); spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
wrqu->data.length = ev - extra; wrqu->data.length = ev - extra;
wrqu->data.flags = 0; wrqu->data.flags = 0;

View File

@ -3388,14 +3388,14 @@ RESET_START:
ieee->sync_scan_hurryup = 1; ieee->sync_scan_hurryup = 1;
if (ieee->state == IEEE80211_LINKED) { if (ieee->state == IEEE80211_LINKED) {
down(&ieee->wx_sem); mutex_lock(&ieee->wx_mutex);
netdev_dbg(dev, "ieee->state is IEEE80211_LINKED\n"); netdev_dbg(dev, "ieee->state is IEEE80211_LINKED\n");
ieee80211_stop_send_beacons(priv->ieee80211); ieee80211_stop_send_beacons(priv->ieee80211);
del_timer_sync(&ieee->associate_timer); del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq); cancel_delayed_work(&ieee->associate_retry_wq);
ieee80211_stop_scan(ieee); ieee80211_stop_scan(ieee);
netif_carrier_off(dev); netif_carrier_off(dev);
up(&ieee->wx_sem); mutex_unlock(&ieee->wx_mutex);
} else { } else {
netdev_dbg(dev, "ieee->state is NOT LINKED\n"); netdev_dbg(dev, "ieee->state is NOT LINKED\n");
ieee80211_softmac_stop_protocol(priv->ieee80211); ieee80211_softmac_stop_protocol(priv->ieee80211);