summaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-01-23 05:42:14 -0500
committerJohannes Berg <johannes.berg@intel.com>2015-01-23 05:42:14 -0500
commitc5309ba78742483514b8f7e447ebe56685894298 (patch)
tree1fdee41e56f413fa2c0c6f0f70401e5e2e88fda4 /net/mac80211
parentd6f5cc091b04c4364c7cd928cef3dff21e2bef55 (diff)
mac80211: tdls: disentangle HT supported conditions
These conditions are rather difficult to follow, for example because "!sta" only exists to not crash in the case that we don't have a station pointer (WLAN_TDLS_SETUP_REQUEST) in which the additional condition (peer supports HT) doesn't actually matter anyway. Cleaning this up only duplicates two lines of code but makes the rest far easier to read, so do that. As a side effect, smatch stops complaining about the lack of a sta pointer test after the !sta (since the !sta goes away) Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/tdls.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 80b66ce9157b..c9f9752217ac 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -345,24 +345,24 @@ ieee80211_tdls_add_setup_start_ies(struct ieee80211_sub_if_data *sdata,
345 */ 345 */
346 sband = local->hw.wiphy->bands[band]; 346 sband = local->hw.wiphy->bands[band];
347 memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap)); 347 memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap));
348 if ((action_code == WLAN_TDLS_SETUP_REQUEST || 348
349 action_code == WLAN_TDLS_SETUP_RESPONSE) && 349 if (action_code == WLAN_TDLS_SETUP_REQUEST && ht_cap.ht_supported) {
350 ht_cap.ht_supported && (!sta || sta->sta.ht_cap.ht_supported)) { 350 ieee80211_apply_htcap_overrides(sdata, &ht_cap);
351 if (action_code == WLAN_TDLS_SETUP_REQUEST) { 351
352 ieee80211_apply_htcap_overrides(sdata, &ht_cap); 352 /* disable SMPS in TDLS initiator */
353 353 ht_cap.cap |= WLAN_HT_CAP_SM_PS_DISABLED
354 /* disable SMPS in TDLS initiator */ 354 << IEEE80211_HT_CAP_SM_PS_SHIFT;
355 ht_cap.cap |= (WLAN_HT_CAP_SM_PS_DISABLED 355
356 << IEEE80211_HT_CAP_SM_PS_SHIFT); 356 pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2);
357 } else { 357 ieee80211_ie_build_ht_cap(pos, &ht_cap, ht_cap.cap);
358 /* disable SMPS in TDLS responder */ 358 } else if (action_code == WLAN_TDLS_SETUP_RESPONSE &&
359 sta->sta.ht_cap.cap |= 359 ht_cap.ht_supported && sta->sta.ht_cap.ht_supported) {
360 (WLAN_HT_CAP_SM_PS_DISABLED 360 /* disable SMPS in TDLS responder */
361 << IEEE80211_HT_CAP_SM_PS_SHIFT); 361 sta->sta.ht_cap.cap |= WLAN_HT_CAP_SM_PS_DISABLED
362 362 << IEEE80211_HT_CAP_SM_PS_SHIFT;
363 /* the peer caps are already intersected with our own */ 363
364 memcpy(&ht_cap, &sta->sta.ht_cap, sizeof(ht_cap)); 364 /* the peer caps are already intersected with our own */
365 } 365 memcpy(&ht_cap, &sta->sta.ht_cap, sizeof(ht_cap));
366 366
367 pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2); 367 pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2);
368 ieee80211_ie_build_ht_cap(pos, &ht_cap, ht_cap.cap); 368 ieee80211_ie_build_ht_cap(pos, &ht_cap, ht_cap.cap);