diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2013-03-29 07:52:17 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-04-03 16:49:53 -0400 |
commit | 9e511c3135ae4937d5cfd6a109c2f7c22e111f65 (patch) | |
tree | 388bde43291822f916f3c129ec6dc8d2c699f427 | |
parent | 1da80e8034911b16b81b5f092097b236b0d8dc6e (diff) |
iwlwifi: mvm: beautify code in BT Coex
The iterators don't need to know what bt_kill_msk means.
All they need to know is if reduced Tx power is enabled
on an interface or not. So change the member of the
iterator to be a bool.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/bt-coex.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c index 398cd9fe68ee..8f626681b3c8 100644 --- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c | |||
@@ -335,9 +335,9 @@ static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, | |||
335 | 335 | ||
336 | struct iwl_bt_iterator_data { | 336 | struct iwl_bt_iterator_data { |
337 | struct iwl_bt_coex_profile_notif *notif; | 337 | struct iwl_bt_coex_profile_notif *notif; |
338 | enum iwl_bt_kill_msk bt_kill_msk; | ||
339 | struct iwl_mvm *mvm; | 338 | struct iwl_mvm *mvm; |
340 | u32 num_bss_ifaces; | 339 | u32 num_bss_ifaces; |
340 | bool reduced_tx_power; | ||
341 | }; | 341 | }; |
342 | 342 | ||
343 | static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | 343 | static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, |
@@ -393,9 +393,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
393 | /* ... cancel reduced Tx power ... */ | 393 | /* ... cancel reduced Tx power ... */ |
394 | if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) | 394 | if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) |
395 | IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); | 395 | IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); |
396 | 396 | data->reduced_tx_power = false; | |
397 | /* ... use default values for bt_kill_msk ... */ | ||
398 | data->bt_kill_msk = BT_KILL_MSK_DEFAULT; | ||
399 | 397 | ||
400 | /* ... and there is no need to get reports on RSSI any more. */ | 398 | /* ... and there is no need to get reports on RSSI any more. */ |
401 | ieee80211_disable_rssi_reports(vif); | 399 | ieee80211_disable_rssi_reports(vif); |
@@ -426,7 +424,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
426 | * One interface hasn't rssi above threshold, bt_kill_msk must | 424 | * One interface hasn't rssi above threshold, bt_kill_msk must |
427 | * be set to default values. | 425 | * be set to default values. |
428 | */ | 426 | */ |
429 | data->bt_kill_msk = BT_KILL_MSK_DEFAULT; | 427 | data->reduced_tx_power = false; |
430 | } | 428 | } |
431 | 429 | ||
432 | /* Begin to monitor the RSSI: it may influence the reduced Tx power */ | 430 | /* Begin to monitor the RSSI: it may influence the reduced Tx power */ |
@@ -440,9 +438,8 @@ static void iwl_mvm_new_bt_coex_notif(struct iwl_mvm *mvm, | |||
440 | struct iwl_bt_iterator_data data = { | 438 | struct iwl_bt_iterator_data data = { |
441 | .mvm = mvm, | 439 | .mvm = mvm, |
442 | .notif = notif, | 440 | .notif = notif, |
443 | .bt_kill_msk = BT_KILL_MSK_REDUCED_TXPOW, | 441 | .reduced_tx_power = true, |
444 | }; | 442 | }; |
445 | bool reduced_tx_power; | ||
446 | 443 | ||
447 | /* remember this notification for future use: rssi fluctuations */ | 444 | /* remember this notification for future use: rssi fluctuations */ |
448 | memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif)); | 445 | memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif)); |
@@ -456,13 +453,9 @@ static void iwl_mvm_new_bt_coex_notif(struct iwl_mvm *mvm, | |||
456 | * irrelevant since it is based on the RSSI coming from the beacon. | 453 | * irrelevant since it is based on the RSSI coming from the beacon. |
457 | * Use BT_KILL_MSK_DEFAULT in that case. | 454 | * Use BT_KILL_MSK_DEFAULT in that case. |
458 | */ | 455 | */ |
459 | if (!data.num_bss_ifaces) | 456 | data.reduced_tx_power = data.reduced_tx_power && data.num_bss_ifaces; |
460 | data.bt_kill_msk = BT_KILL_MSK_DEFAULT; | ||
461 | 457 | ||
462 | reduced_tx_power = data.num_bss_ifaces && | 458 | if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm, data.reduced_tx_power)) |
463 | data.bt_kill_msk == BT_KILL_MSK_REDUCED_TXPOW; | ||
464 | |||
465 | if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm, reduced_tx_power)) | ||
466 | IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); | 459 | IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); |
467 | } | 460 | } |
468 | 461 | ||
@@ -515,7 +508,7 @@ static void iwl_mvm_bt_rssi_iterator(void *_data, u8 *mac, | |||
515 | * RSSI probably), then set bt_kill_msk to default values. | 508 | * RSSI probably), then set bt_kill_msk to default values. |
516 | */ | 509 | */ |
517 | if (!mvmsta->bt_reduced_txpower) | 510 | if (!mvmsta->bt_reduced_txpower) |
518 | data->bt_kill_msk = BT_KILL_MSK_DEFAULT; | 511 | data->reduced_tx_power = false; |
519 | /* else - possibly leave it to BT_KILL_MSK_REDUCED_TXPOW */ | 512 | /* else - possibly leave it to BT_KILL_MSK_REDUCED_TXPOW */ |
520 | } | 513 | } |
521 | 514 | ||
@@ -523,10 +516,9 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
523 | enum ieee80211_rssi_event rssi_event) | 516 | enum ieee80211_rssi_event rssi_event) |
524 | { | 517 | { |
525 | struct iwl_mvm_vif *mvmvif = (void *)vif->drv_priv; | 518 | struct iwl_mvm_vif *mvmvif = (void *)vif->drv_priv; |
526 | bool reduced_tx_power; | ||
527 | struct iwl_bt_iterator_data data = { | 519 | struct iwl_bt_iterator_data data = { |
528 | .mvm = mvm, | 520 | .mvm = mvm, |
529 | .bt_kill_msk = BT_KILL_MSK_REDUCED_TXPOW, | 521 | .reduced_tx_power = true, |
530 | }; | 522 | }; |
531 | int ret; | 523 | int ret; |
532 | 524 | ||
@@ -565,13 +557,9 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
565 | * irrelevant since it is based on the RSSI coming from the beacon. | 557 | * irrelevant since it is based on the RSSI coming from the beacon. |
566 | * Use BT_KILL_MSK_DEFAULT in that case. | 558 | * Use BT_KILL_MSK_DEFAULT in that case. |
567 | */ | 559 | */ |
568 | if (!data.num_bss_ifaces) | 560 | data.reduced_tx_power = data.reduced_tx_power && data.num_bss_ifaces; |
569 | data.bt_kill_msk = BT_KILL_MSK_DEFAULT; | ||
570 | |||
571 | reduced_tx_power = data.num_bss_ifaces && | ||
572 | data.bt_kill_msk == BT_KILL_MSK_REDUCED_TXPOW; | ||
573 | 561 | ||
574 | if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm, reduced_tx_power)) | 562 | if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm, data.reduced_tx_power)) |
575 | IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); | 563 | IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); |
576 | 564 | ||
577 | out_unlock: | 565 | out_unlock: |