Skip to content

Commit d8a2c51

Browse files
Sujith Manoharanlinvjw
authored andcommitted
ath9k_htc: Use atomic operations for op_flags
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent fb1c078 commit d8a2c51

6 files changed

Lines changed: 37 additions & 37 deletions

File tree

‎drivers/net/wireless/ath/ath9k/htc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,14 @@ struct ath9k_htc_priv {
453453
u8 num_sta_assoc_vif;
454454
u8 num_ap_vif;
455455

456-
u16 op_flags;
457456
u16 curtxpow;
458457
u16 txpowlimit;
459458
u16 nvifs;
460459
u16 nstations;
461460
bool rearm_ani;
462461
bool reconfig_beacon;
463462
unsigned int rxfilter;
463+
unsigned long op_flags;
464464

465465
struct ath9k_hw_cal_data caldata;
466466
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];

‎drivers/net/wireless/ath/ath9k/htc_drv_beacon.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv,
207207
else
208208
priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE;
209209

210-
if (priv->op_flags & OP_TSF_RESET) {
210+
if (test_bit(OP_TSF_RESET, &priv->op_flags)) {
211211
ath9k_hw_reset_tsf(priv->ah);
212-
priv->op_flags &= ~OP_TSF_RESET;
212+
clear_bit(OP_TSF_RESET, &priv->op_flags);
213213
} else {
214214
/*
215215
* Pull nexttbtt forward to reflect the current TSF.
@@ -221,7 +221,7 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv,
221221
} while (nexttbtt < tsftu);
222222
}
223223

224-
if (priv->op_flags & OP_ENABLE_BEACON)
224+
if (test_bit(OP_ENABLE_BEACON, &priv->op_flags))
225225
imask |= ATH9K_INT_SWBA;
226226

227227
ath_dbg(common, CONFIG,
@@ -269,7 +269,7 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
269269
else
270270
priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE;
271271

272-
if (priv->op_flags & OP_ENABLE_BEACON)
272+
if (test_bit(OP_ENABLE_BEACON, &priv->op_flags))
273273
imask |= ATH9K_INT_SWBA;
274274

275275
ath_dbg(common, CONFIG,
@@ -365,7 +365,7 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv *priv,
365365
vif = priv->cur_beacon_conf.bslot[slot];
366366
avp = (struct ath9k_htc_vif *)vif->drv_priv;
367367

368-
if (unlikely(priv->op_flags & OP_SCANNING)) {
368+
if (unlikely(test_bit(OP_SCANNING, &priv->op_flags))) {
369369
spin_unlock_bh(&priv->beacon_lock);
370370
return;
371371
}

‎drivers/net/wireless/ath/ath9k/htc_drv_gpio.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@ static void ath_detect_bt_priority(struct ath9k_htc_priv *priv)
3737

3838
if (time_after(jiffies, btcoex->bt_priority_time +
3939
msecs_to_jiffies(ATH_BT_PRIORITY_TIME_THRESHOLD))) {
40-
priv->op_flags &= ~(OP_BT_PRIORITY_DETECTED | OP_BT_SCAN);
40+
clear_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags);
41+
clear_bit(OP_BT_SCAN, &priv->op_flags);
4142
/* Detect if colocated bt started scanning */
4243
if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) {
4344
ath_dbg(ath9k_hw_common(ah), BTCOEX,
4445
"BT scan detected\n");
45-
priv->op_flags |= (OP_BT_SCAN |
46-
OP_BT_PRIORITY_DETECTED);
46+
set_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags);
47+
set_bit(OP_BT_SCAN, &priv->op_flags);
4748
} else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) {
4849
ath_dbg(ath9k_hw_common(ah), BTCOEX,
4950
"BT priority traffic detected\n");
50-
priv->op_flags |= OP_BT_PRIORITY_DETECTED;
51+
set_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags);
5152
}
5253

5354
btcoex->bt_priority_cnt = 0;
@@ -67,26 +68,23 @@ static void ath_btcoex_period_work(struct work_struct *work)
6768
struct ath_btcoex *btcoex = &priv->btcoex;
6869
struct ath_common *common = ath9k_hw_common(priv->ah);
6970
u32 timer_period;
70-
bool is_btscan;
7171
int ret;
7272

7373
ath_detect_bt_priority(priv);
7474

75-
is_btscan = !!(priv->op_flags & OP_BT_SCAN);
76-
7775
ret = ath9k_htc_update_cap_target(priv,
78-
!!(priv->op_flags & OP_BT_PRIORITY_DETECTED));
76+
test_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags));
7977
if (ret) {
8078
ath_err(common, "Unable to set BTCOEX parameters\n");
8179
return;
8280
}
8381

84-
ath9k_hw_btcoex_bt_stomp(priv->ah, is_btscan ? ATH_BTCOEX_STOMP_ALL :
85-
btcoex->bt_stomp_type);
82+
ath9k_hw_btcoex_bt_stomp(priv->ah, test_bit(OP_BT_SCAN, &priv->op_flags) ?
83+
ATH_BTCOEX_STOMP_ALL : btcoex->bt_stomp_type);
8684

8785
ath9k_hw_btcoex_enable(priv->ah);
88-
timer_period = is_btscan ? btcoex->btscan_no_stomp :
89-
btcoex->btcoex_no_stomp;
86+
timer_period = test_bit(OP_BT_SCAN, &priv->op_flags) ?
87+
btcoex->btscan_no_stomp : btcoex->btcoex_no_stomp;
9088
ieee80211_queue_delayed_work(priv->hw, &priv->duty_cycle_work,
9189
msecs_to_jiffies(timer_period));
9290
ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work,
@@ -104,14 +102,15 @@ static void ath_btcoex_duty_cycle_work(struct work_struct *work)
104102
struct ath_hw *ah = priv->ah;
105103
struct ath_btcoex *btcoex = &priv->btcoex;
106104
struct ath_common *common = ath9k_hw_common(ah);
107-
bool is_btscan = priv->op_flags & OP_BT_SCAN;
108105

109106
ath_dbg(common, BTCOEX, "time slice work for bt and wlan\n");
110107

111-
if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan)
108+
if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW ||
109+
test_bit(OP_BT_SCAN, &priv->op_flags))
112110
ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE);
113111
else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL)
114112
ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW);
113+
115114
ath9k_hw_btcoex_enable(priv->ah);
116115
}
117116

@@ -141,7 +140,8 @@ static void ath_htc_resume_btcoex_work(struct ath9k_htc_priv *priv)
141140

142141
btcoex->bt_priority_cnt = 0;
143142
btcoex->bt_priority_time = jiffies;
144-
priv->op_flags &= ~(OP_BT_PRIORITY_DETECTED | OP_BT_SCAN);
143+
clear_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags);
144+
clear_bit(OP_BT_SCAN, &priv->op_flags);
145145
ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work, 0);
146146
}
147147

‎drivers/net/wireless/ath/ath9k/htc_drv_init.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
611611
struct ath_common *common;
612612
int i, ret = 0, csz = 0;
613613

614-
priv->op_flags |= OP_INVALID;
614+
set_bit(OP_INVALID, &priv->op_flags);
615615

616616
ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL);
617617
if (!ah)

‎drivers/net/wireless/ath/ath9k/htc_drv_main.c‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
250250
u8 cmd_rsp;
251251
int ret;
252252

253-
if (priv->op_flags & OP_INVALID)
253+
if (test_bit(OP_INVALID, &priv->op_flags))
254254
return -EIO;
255255

256256
fastcc = !!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL);
@@ -304,7 +304,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
304304

305305
htc_start(priv->htc);
306306

307-
if (!(priv->op_flags & OP_SCANNING) &&
307+
if (!test_bit(OP_SCANNING, &priv->op_flags) &&
308308
!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL))
309309
ath9k_htc_vif_reconfig(priv);
310310

@@ -750,7 +750,7 @@ void ath9k_htc_start_ani(struct ath9k_htc_priv *priv)
750750
common->ani.shortcal_timer = timestamp;
751751
common->ani.checkani_timer = timestamp;
752752

753-
priv->op_flags |= OP_ANI_RUNNING;
753+
set_bit(OP_ANI_RUNNING, &priv->op_flags);
754754

755755
ieee80211_queue_delayed_work(common->hw, &priv->ani_work,
756756
msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
@@ -759,7 +759,7 @@ void ath9k_htc_start_ani(struct ath9k_htc_priv *priv)
759759
void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv)
760760
{
761761
cancel_delayed_work_sync(&priv->ani_work);
762-
priv->op_flags &= ~OP_ANI_RUNNING;
762+
clear_bit(OP_ANI_RUNNING, &priv->op_flags);
763763
}
764764

765765
void ath9k_htc_ani_work(struct work_struct *work)
@@ -944,7 +944,7 @@ static int ath9k_htc_start(struct ieee80211_hw *hw)
944944
ath_dbg(common, CONFIG,
945945
"Failed to update capability in target\n");
946946

947-
priv->op_flags &= ~OP_INVALID;
947+
clear_bit(OP_INVALID, &priv->op_flags);
948948
htc_start(priv->htc);
949949

950950
spin_lock_bh(&priv->tx.tx_lock);
@@ -973,7 +973,7 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
973973

974974
mutex_lock(&priv->mutex);
975975

976-
if (priv->op_flags & OP_INVALID) {
976+
if (test_bit(OP_INVALID, &priv->op_flags)) {
977977
ath_dbg(common, ANY, "Device not present\n");
978978
mutex_unlock(&priv->mutex);
979979
return;
@@ -1015,7 +1015,7 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
10151015
ath9k_htc_ps_restore(priv);
10161016
ath9k_htc_setpower(priv, ATH9K_PM_FULL_SLEEP);
10171017

1018-
priv->op_flags |= OP_INVALID;
1018+
set_bit(OP_INVALID, &priv->op_flags);
10191019

10201020
ath_dbg(common, CONFIG, "Driver halt\n");
10211021
mutex_unlock(&priv->mutex);
@@ -1105,7 +1105,7 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
11051105
ath9k_htc_set_opmode(priv);
11061106

11071107
if ((priv->ah->opmode == NL80211_IFTYPE_AP) &&
1108-
!(priv->op_flags & OP_ANI_RUNNING)) {
1108+
!test_bit(OP_ANI_RUNNING, &priv->op_flags)) {
11091109
ath9k_hw_set_tsfadjust(priv->ah, 1);
11101110
ath9k_htc_start_ani(priv);
11111111
}
@@ -1285,7 +1285,7 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw,
12851285
changed_flags &= SUPPORTED_FILTERS;
12861286
*total_flags &= SUPPORTED_FILTERS;
12871287

1288-
if (priv->op_flags & OP_INVALID) {
1288+
if (test_bit(OP_INVALID, &priv->op_flags)) {
12891289
ath_dbg(ath9k_hw_common(priv->ah), ANY,
12901290
"Unable to configure filter on invalid state\n");
12911291
mutex_unlock(&priv->mutex);
@@ -1517,7 +1517,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
15171517
ath_dbg(common, CONFIG, "Beacon enabled for BSS: %pM\n",
15181518
bss_conf->bssid);
15191519
ath9k_htc_set_tsfadjust(priv, vif);
1520-
priv->op_flags |= OP_ENABLE_BEACON;
1520+
set_bit(OP_ENABLE_BEACON, &priv->op_flags);
15211521
ath9k_htc_beacon_config(priv, vif);
15221522
}
15231523

@@ -1530,7 +1530,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
15301530
ath_dbg(common, CONFIG,
15311531
"Beacon disabled for BSS: %pM\n",
15321532
bss_conf->bssid);
1533-
priv->op_flags &= ~OP_ENABLE_BEACON;
1533+
clear_bit(OP_ENABLE_BEACON, &priv->op_flags);
15341534
ath9k_htc_beacon_config(priv, vif);
15351535
}
15361536
}
@@ -1543,7 +1543,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
15431543
(priv->nvifs == 1) &&
15441544
(priv->num_ap_vif == 1) &&
15451545
(vif->type == NL80211_IFTYPE_AP)) {
1546-
priv->op_flags |= OP_TSF_RESET;
1546+
set_bit(OP_TSF_RESET, &priv->op_flags);
15471547
}
15481548
ath_dbg(common, CONFIG,
15491549
"Beacon interval changed for BSS: %pM\n",
@@ -1655,7 +1655,7 @@ static void ath9k_htc_sw_scan_start(struct ieee80211_hw *hw)
16551655

16561656
mutex_lock(&priv->mutex);
16571657
spin_lock_bh(&priv->beacon_lock);
1658-
priv->op_flags |= OP_SCANNING;
1658+
set_bit(OP_SCANNING, &priv->op_flags);
16591659
spin_unlock_bh(&priv->beacon_lock);
16601660
cancel_work_sync(&priv->ps_work);
16611661
ath9k_htc_stop_ani(priv);
@@ -1668,7 +1668,7 @@ static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw)
16681668

16691669
mutex_lock(&priv->mutex);
16701670
spin_lock_bh(&priv->beacon_lock);
1671-
priv->op_flags &= ~OP_SCANNING;
1671+
clear_bit(OP_SCANNING, &priv->op_flags);
16721672
spin_unlock_bh(&priv->beacon_lock);
16731673
ath9k_htc_ps_wakeup(priv);
16741674
ath9k_htc_vif_reconfig(priv);

‎drivers/net/wireless/ath/ath9k/htc_drv_txrx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ void ath9k_host_rx_init(struct ath9k_htc_priv *priv)
916916
{
917917
ath9k_hw_rxena(priv->ah);
918918
ath9k_htc_opmode_init(priv);
919-
ath9k_hw_startpcureceive(priv->ah, (priv->op_flags & OP_SCANNING));
919+
ath9k_hw_startpcureceive(priv->ah, test_bit(OP_SCANNING, &priv->op_flags));
920920
priv->rx.last_rssi = ATH_RSSI_DUMMY_MARKER;
921921
}
922922

0 commit comments

Comments
 (0)