rtlwifi: Switch locking from semaphores to mutexes

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index 9e860ff..87530ea 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -309,8 +309,8 @@
 	}
 
 	/* <4> locks */
-	sema_init(&rtlpriv->locks.ips_sem, 1);
-	sema_init(&rtlpriv->locks.conf_sem, 1);
+	mutex_init(&rtlpriv->locks.ips_mutex);
+	mutex_init(&rtlpriv->locks.conf_mutex);
 	spin_lock_init(&rtlpriv->locks.irq_th_lock);
 	spin_lock_init(&rtlpriv->locks.h2c_lock);
 	spin_lock_init(&rtlpriv->locks.rf_ps_lock);
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index 81b290f..d6a924a 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -43,13 +43,13 @@
 		return 0;
 	if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status))
 		return 0;
-	down(&rtlpriv->locks.conf_sem);
+	mutex_lock(&rtlpriv->locks.conf_mutex);
 	err = rtlpriv->intf_ops->adapter_start(hw);
 	if (err)
 		goto out;
 	rtl_watch_dog_timer_callback((unsigned long)hw);
 out:
-	up(&rtlpriv->locks.conf_sem);
+	mutex_unlock(&rtlpriv->locks.conf_mutex);
 	return err;
 }
 
@@ -68,7 +68,7 @@
 		mdelay(1);
 	}
 
-	down(&rtlpriv->locks.conf_sem);
+	mutex_lock(&rtlpriv->locks.conf_mutex);
 
 	mac->link_state = MAC80211_NOLINK;
 	memset(mac->bssid, 0, 6);
@@ -79,7 +79,7 @@
 	rtl_deinit_deferred_work(hw);
 	rtlpriv->intf_ops->adapter_stop(hw);
 
-	up(&rtlpriv->locks.conf_sem);
+	mutex_unlock(&rtlpriv->locks.conf_mutex);
 }
 
 static int rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
@@ -119,7 +119,7 @@
 
 	rtl_ips_nic_on(hw);
 
-	down(&rtlpriv->locks.conf_sem);
+	mutex_lock(&rtlpriv->locks.conf_mutex);
 	switch (vif->type) {
 	case NL80211_IFTYPE_STATION:
 		if (mac->beacon_enabled == 1) {
@@ -156,7 +156,7 @@
 	rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr);
 
 out:
-	up(&rtlpriv->locks.conf_sem);
+	mutex_unlock(&rtlpriv->locks.conf_mutex);
 	return err;
 }
 
@@ -166,7 +166,7 @@
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
 
-	down(&rtlpriv->locks.conf_sem);
+	mutex_lock(&rtlpriv->locks.conf_mutex);
 
 	/* Free beacon resources */
 	if ((mac->opmode == NL80211_IFTYPE_AP) ||
@@ -190,7 +190,7 @@
 	mac->opmode = NL80211_IFTYPE_UNSPECIFIED;
 	rtlpriv->cfg->ops->set_network_type(hw, mac->opmode);
 
-	up(&rtlpriv->locks.conf_sem);
+	mutex_unlock(&rtlpriv->locks.conf_mutex);
 }
 
 
@@ -202,7 +202,7 @@
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
 	struct ieee80211_conf *conf = &hw->conf;
 
-	down(&rtlpriv->locks.conf_sem);
+	mutex_lock(&rtlpriv->locks.conf_mutex);
 	if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) {	/*BIT(2)*/
 		RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
 			 ("IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n"));
@@ -303,7 +303,7 @@
 					       hw->conf.channel_type);
 	}
 
-	up(&rtlpriv->locks.conf_sem);
+	mutex_unlock(&rtlpriv->locks.conf_mutex);
 
 	return 0;
 }
@@ -450,7 +450,7 @@
 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
 
-	down(&rtlpriv->locks.conf_sem);
+	mutex_lock(&rtlpriv->locks.conf_mutex);
 
 	if ((vif->type == NL80211_IFTYPE_ADHOC) ||
 	    (vif->type == NL80211_IFTYPE_AP) ||
@@ -700,7 +700,7 @@
 	}
 
 out:
-	up(&rtlpriv->locks.conf_sem);
+	mutex_unlock(&rtlpriv->locks.conf_mutex);
 }
 
 static u64 rtl_op_get_tsf(struct ieee80211_hw *hw)
@@ -852,7 +852,7 @@
 		  sta ? sta->addr : bcast_addr));
 	rtlpriv->sec.being_setkey = true;
 	rtl_ips_nic_on(hw);
-	down(&rtlpriv->locks.conf_sem);
+	mutex_lock(&rtlpriv->locks.conf_mutex);
 	/* <1> get encryption alg */
 	switch (key->cipher) {
 	case WLAN_CIPHER_SUITE_WEP40:
@@ -970,7 +970,7 @@
 			 ("cmd_err:%x!!!!:\n", cmd));
 	}
 out_unlock:
-	up(&rtlpriv->locks.conf_sem);
+	mutex_unlock(&rtlpriv->locks.conf_mutex);
 	rtlpriv->sec.being_setkey = false;
 	return err;
 }
@@ -986,7 +986,7 @@
 	if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status))
 		return;
 
-	down(&rtlpriv->locks.conf_sem);
+	mutex_lock(&rtlpriv->locks.conf_mutex);
 
 	/*if Radio On return true here */
 	radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid);
@@ -1004,7 +1004,7 @@
 		}
 	}
 
-	up(&rtlpriv->locks.conf_sem);
+	mutex_unlock(&rtlpriv->locks.conf_mutex);
 }
 
 const struct ieee80211_ops rtl_ops = {
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c
index fd77cd5..22c293e 100644
--- a/drivers/net/wireless/rtlwifi/ps.c
+++ b/drivers/net/wireless/rtlwifi/ps.c
@@ -287,7 +287,7 @@
 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
 	enum rf_pwrstate rtstate;
 
-	down(&rtlpriv->locks.ips_sem);
+	mutex_lock(&rtlpriv->locks.ips_mutex);
 
 	if (ppsc->b_inactiveps) {
 		rtstate = ppsc->rfpwr_state;
@@ -303,7 +303,7 @@
 		}
 	}
 
-	up(&rtlpriv->locks.ips_sem);
+	mutex_unlock(&rtlpriv->locks.ips_mutex);
 }
 
 /*for FW LPS*/
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 3844dc9..77d5fa3 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1193,8 +1193,8 @@
 
 struct rtl_locks {
 	/*sem */
-	struct semaphore ips_sem;
-	struct semaphore conf_sem;
+	struct mutex ips_mutex;
+	struct mutex conf_mutex;
 
 	/*spin lock */
 	spinlock_t irq_th_lock;