aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2010-12-16 12:13:57 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-16 15:22:32 -0500
commit8a09d6d80c90c02f2f8c89f69c702cab0c8d9b42 (patch)
tree09c1439790d4eaa463a265aabee89845013d31f0 /drivers/net/wireless/rtlwifi
parent3cf0c8ad94ba1ba241b970cd19c11a4f3cea93c2 (diff)
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>
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r--drivers/net/wireless/rtlwifi/base.c4
-rw-r--r--drivers/net/wireless/rtlwifi/core.c32
-rw-r--r--drivers/net/wireless/rtlwifi/ps.c4
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h4
4 files changed, 22 insertions, 22 deletions
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index 9e860ff30b52..87530eaa88bd 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -309,8 +309,8 @@ int rtl_init_core(struct ieee80211_hw *hw)
309 } 309 }
310 310
311 /* <4> locks */ 311 /* <4> locks */
312 sema_init(&rtlpriv->locks.ips_sem, 1); 312 mutex_init(&rtlpriv->locks.ips_mutex);
313 sema_init(&rtlpriv->locks.conf_sem, 1); 313 mutex_init(&rtlpriv->locks.conf_mutex);
314 spin_lock_init(&rtlpriv->locks.irq_th_lock); 314 spin_lock_init(&rtlpriv->locks.irq_th_lock);
315 spin_lock_init(&rtlpriv->locks.h2c_lock); 315 spin_lock_init(&rtlpriv->locks.h2c_lock);
316 spin_lock_init(&rtlpriv->locks.rf_ps_lock); 316 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 81b290ff8a94..d6a924a05654 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -43,13 +43,13 @@ static int rtl_op_start(struct ieee80211_hw *hw)
43 return 0; 43 return 0;
44 if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) 44 if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status))
45 return 0; 45 return 0;
46 down(&rtlpriv->locks.conf_sem); 46 mutex_lock(&rtlpriv->locks.conf_mutex);
47 err = rtlpriv->intf_ops->adapter_start(hw); 47 err = rtlpriv->intf_ops->adapter_start(hw);
48 if (err) 48 if (err)
49 goto out; 49 goto out;
50 rtl_watch_dog_timer_callback((unsigned long)hw); 50 rtl_watch_dog_timer_callback((unsigned long)hw);
51out: 51out:
52 up(&rtlpriv->locks.conf_sem); 52 mutex_unlock(&rtlpriv->locks.conf_mutex);
53 return err; 53 return err;
54} 54}
55 55
@@ -68,7 +68,7 @@ static void rtl_op_stop(struct ieee80211_hw *hw)
68 mdelay(1); 68 mdelay(1);
69 } 69 }
70 70
71 down(&rtlpriv->locks.conf_sem); 71 mutex_lock(&rtlpriv->locks.conf_mutex);
72 72
73 mac->link_state = MAC80211_NOLINK; 73 mac->link_state = MAC80211_NOLINK;
74 memset(mac->bssid, 0, 6); 74 memset(mac->bssid, 0, 6);
@@ -79,7 +79,7 @@ static void rtl_op_stop(struct ieee80211_hw *hw)
79 rtl_deinit_deferred_work(hw); 79 rtl_deinit_deferred_work(hw);
80 rtlpriv->intf_ops->adapter_stop(hw); 80 rtlpriv->intf_ops->adapter_stop(hw);
81 81
82 up(&rtlpriv->locks.conf_sem); 82 mutex_unlock(&rtlpriv->locks.conf_mutex);
83} 83}
84 84
85static int rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 85static int rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
@@ -119,7 +119,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
119 119
120 rtl_ips_nic_on(hw); 120 rtl_ips_nic_on(hw);
121 121
122 down(&rtlpriv->locks.conf_sem); 122 mutex_lock(&rtlpriv->locks.conf_mutex);
123 switch (vif->type) { 123 switch (vif->type) {
124 case NL80211_IFTYPE_STATION: 124 case NL80211_IFTYPE_STATION:
125 if (mac->beacon_enabled == 1) { 125 if (mac->beacon_enabled == 1) {
@@ -156,7 +156,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
156 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr); 156 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr);
157 157
158out: 158out:
159 up(&rtlpriv->locks.conf_sem); 159 mutex_unlock(&rtlpriv->locks.conf_mutex);
160 return err; 160 return err;
161} 161}
162 162
@@ -166,7 +166,7 @@ static void rtl_op_remove_interface(struct ieee80211_hw *hw,
166 struct rtl_priv *rtlpriv = rtl_priv(hw); 166 struct rtl_priv *rtlpriv = rtl_priv(hw);
167 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 167 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
168 168
169 down(&rtlpriv->locks.conf_sem); 169 mutex_lock(&rtlpriv->locks.conf_mutex);
170 170
171 /* Free beacon resources */ 171 /* Free beacon resources */
172 if ((mac->opmode == NL80211_IFTYPE_AP) || 172 if ((mac->opmode == NL80211_IFTYPE_AP) ||
@@ -190,7 +190,7 @@ static void rtl_op_remove_interface(struct ieee80211_hw *hw,
190 mac->opmode = NL80211_IFTYPE_UNSPECIFIED; 190 mac->opmode = NL80211_IFTYPE_UNSPECIFIED;
191 rtlpriv->cfg->ops->set_network_type(hw, mac->opmode); 191 rtlpriv->cfg->ops->set_network_type(hw, mac->opmode);
192 192
193 up(&rtlpriv->locks.conf_sem); 193 mutex_unlock(&rtlpriv->locks.conf_mutex);
194} 194}
195 195
196 196
@@ -202,7 +202,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
202 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 202 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
203 struct ieee80211_conf *conf = &hw->conf; 203 struct ieee80211_conf *conf = &hw->conf;
204 204
205 down(&rtlpriv->locks.conf_sem); 205 mutex_lock(&rtlpriv->locks.conf_mutex);
206 if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /*BIT(2)*/ 206 if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /*BIT(2)*/
207 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 207 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
208 ("IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n")); 208 ("IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n"));
@@ -303,7 +303,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
303 hw->conf.channel_type); 303 hw->conf.channel_type);
304 } 304 }
305 305
306 up(&rtlpriv->locks.conf_sem); 306 mutex_unlock(&rtlpriv->locks.conf_mutex);
307 307
308 return 0; 308 return 0;
309} 309}
@@ -450,7 +450,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
450 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 450 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
451 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 451 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
452 452
453 down(&rtlpriv->locks.conf_sem); 453 mutex_lock(&rtlpriv->locks.conf_mutex);
454 454
455 if ((vif->type == NL80211_IFTYPE_ADHOC) || 455 if ((vif->type == NL80211_IFTYPE_ADHOC) ||
456 (vif->type == NL80211_IFTYPE_AP) || 456 (vif->type == NL80211_IFTYPE_AP) ||
@@ -700,7 +700,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
700 } 700 }
701 701
702out: 702out:
703 up(&rtlpriv->locks.conf_sem); 703 mutex_unlock(&rtlpriv->locks.conf_mutex);
704} 704}
705 705
706static u64 rtl_op_get_tsf(struct ieee80211_hw *hw) 706static u64 rtl_op_get_tsf(struct ieee80211_hw *hw)
@@ -852,7 +852,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
852 sta ? sta->addr : bcast_addr)); 852 sta ? sta->addr : bcast_addr));
853 rtlpriv->sec.being_setkey = true; 853 rtlpriv->sec.being_setkey = true;
854 rtl_ips_nic_on(hw); 854 rtl_ips_nic_on(hw);
855 down(&rtlpriv->locks.conf_sem); 855 mutex_lock(&rtlpriv->locks.conf_mutex);
856 /* <1> get encryption alg */ 856 /* <1> get encryption alg */
857 switch (key->cipher) { 857 switch (key->cipher) {
858 case WLAN_CIPHER_SUITE_WEP40: 858 case WLAN_CIPHER_SUITE_WEP40:
@@ -970,7 +970,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
970 ("cmd_err:%x!!!!:\n", cmd)); 970 ("cmd_err:%x!!!!:\n", cmd));
971 } 971 }
972out_unlock: 972out_unlock:
973 up(&rtlpriv->locks.conf_sem); 973 mutex_unlock(&rtlpriv->locks.conf_mutex);
974 rtlpriv->sec.being_setkey = false; 974 rtlpriv->sec.being_setkey = false;
975 return err; 975 return err;
976} 976}
@@ -986,7 +986,7 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw)
986 if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) 986 if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status))
987 return; 987 return;
988 988
989 down(&rtlpriv->locks.conf_sem); 989 mutex_lock(&rtlpriv->locks.conf_mutex);
990 990
991 /*if Radio On return true here */ 991 /*if Radio On return true here */
992 radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid); 992 radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid);
@@ -1004,7 +1004,7 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw)
1004 } 1004 }
1005 } 1005 }
1006 1006
1007 up(&rtlpriv->locks.conf_sem); 1007 mutex_unlock(&rtlpriv->locks.conf_mutex);
1008} 1008}
1009 1009
1010const struct ieee80211_ops rtl_ops = { 1010const struct ieee80211_ops rtl_ops = {
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c
index fd77cd508f50..22c293e5b88c 100644
--- a/drivers/net/wireless/rtlwifi/ps.c
+++ b/drivers/net/wireless/rtlwifi/ps.c
@@ -287,7 +287,7 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw)
287 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 287 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
288 enum rf_pwrstate rtstate; 288 enum rf_pwrstate rtstate;
289 289
290 down(&rtlpriv->locks.ips_sem); 290 mutex_lock(&rtlpriv->locks.ips_mutex);
291 291
292 if (ppsc->b_inactiveps) { 292 if (ppsc->b_inactiveps) {
293 rtstate = ppsc->rfpwr_state; 293 rtstate = ppsc->rfpwr_state;
@@ -303,7 +303,7 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw)
303 } 303 }
304 } 304 }
305 305
306 up(&rtlpriv->locks.ips_sem); 306 mutex_unlock(&rtlpriv->locks.ips_mutex);
307} 307}
308 308
309/*for FW LPS*/ 309/*for FW LPS*/
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 3844dc94bdbf..77d5fa370bdc 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1193,8 +1193,8 @@ struct rtl_hal_cfg {
1193 1193
1194struct rtl_locks { 1194struct rtl_locks {
1195 /*sem */ 1195 /*sem */
1196 struct semaphore ips_sem; 1196 struct mutex ips_mutex;
1197 struct semaphore conf_sem; 1197 struct mutex conf_mutex;
1198 1198
1199 /*spin lock */ 1199 /*spin lock */
1200 spinlock_t irq_th_lock; 1200 spinlock_t irq_th_lock;