aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-01-28 10:47:51 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-28 15:46:25 -0500
commit9f60e7ee4206507c7f248d06e3b4a8a59ed33308 (patch)
treea7c474b404ccb0ec0c433dcca1d2c6498a623b0c
parent8c9f514b38bb01f0af09f880fe8b3cd5342d2401 (diff)
iwlwifi: introduce iwl_bt_statistics
We use priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics conditional in few places, merge it into one function. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-calib.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rx.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c2
6 files changed, 19 insertions, 27 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
index d16bb5ede014..9006293e740c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
@@ -631,8 +631,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp)
631 } 631 }
632 632
633 spin_lock_irqsave(&priv->lock, flags); 633 spin_lock_irqsave(&priv->lock, flags);
634 if (priv->cfg->bt_params && 634 if (iwl_bt_statistics(priv)) {
635 priv->cfg->bt_params->bt_statistics) {
636 rx_info = &(((struct iwl_bt_notif_statistics *)resp)-> 635 rx_info = &(((struct iwl_bt_notif_statistics *)resp)->
637 rx.general.common); 636 rx.general.common);
638 ofdm = &(((struct iwl_bt_notif_statistics *)resp)->rx.ofdm); 637 ofdm = &(((struct iwl_bt_notif_statistics *)resp)->rx.ofdm);
@@ -897,8 +896,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
897 } 896 }
898 897
899 spin_lock_irqsave(&priv->lock, flags); 898 spin_lock_irqsave(&priv->lock, flags);
900 if (priv->cfg->bt_params && 899 if (iwl_bt_statistics(priv)) {
901 priv->cfg->bt_params->bt_statistics) {
902 rx_info = &(((struct iwl_bt_notif_statistics *)stat_resp)-> 900 rx_info = &(((struct iwl_bt_notif_statistics *)stat_resp)->
903 rx.general.common); 901 rx.general.common);
904 } else { 902 } else {
@@ -913,8 +911,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
913 911
914 rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK); 912 rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK);
915 rxon_chnum = le16_to_cpu(ctx->staging.channel); 913 rxon_chnum = le16_to_cpu(ctx->staging.channel);
916 if (priv->cfg->bt_params && 914 if (iwl_bt_statistics(priv)) {
917 priv->cfg->bt_params->bt_statistics) {
918 stat_band24 = !!(((struct iwl_bt_notif_statistics *) 915 stat_band24 = !!(((struct iwl_bt_notif_statistics *)
919 stat_resp)->flag & 916 stat_resp)->flag &
920 STATISTICS_REPLY_FLG_BAND_24G_MSK); 917 STATISTICS_REPLY_FLG_BAND_24G_MSK);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
index a6dbd8983dac..b500aaae53ec 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
@@ -39,8 +39,7 @@ static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
39 int p = 0; 39 int p = 0;
40 u32 flag; 40 u32 flag;
41 41
42 if (priv->cfg->bt_params && 42 if (iwl_bt_statistics(priv))
43 priv->cfg->bt_params->bt_statistics)
44 flag = le32_to_cpu(priv->_agn.statistics_bt.flag); 43 flag = le32_to_cpu(priv->_agn.statistics_bt.flag);
45 else 44 else
46 flag = le32_to_cpu(priv->_agn.statistics.flag); 45 flag = le32_to_cpu(priv->_agn.statistics.flag);
@@ -89,8 +88,7 @@ ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
89 * the last statistics notification from uCode 88 * the last statistics notification from uCode
90 * might not reflect the current uCode activity 89 * might not reflect the current uCode activity
91 */ 90 */
92 if (priv->cfg->bt_params && 91 if (iwl_bt_statistics(priv)) {
93 priv->cfg->bt_params->bt_statistics) {
94 ofdm = &priv->_agn.statistics_bt.rx.ofdm; 92 ofdm = &priv->_agn.statistics_bt.rx.ofdm;
95 cck = &priv->_agn.statistics_bt.rx.cck; 93 cck = &priv->_agn.statistics_bt.rx.cck;
96 general = &priv->_agn.statistics_bt.rx.general.common; 94 general = &priv->_agn.statistics_bt.rx.general.common;
@@ -536,8 +534,7 @@ ssize_t iwl_ucode_tx_stats_read(struct file *file,
536 * the last statistics notification from uCode 534 * the last statistics notification from uCode
537 * might not reflect the current uCode activity 535 * might not reflect the current uCode activity
538 */ 536 */
539 if (priv->cfg->bt_params && 537 if (iwl_bt_statistics(priv)) {
540 priv->cfg->bt_params->bt_statistics) {
541 tx = &priv->_agn.statistics_bt.tx; 538 tx = &priv->_agn.statistics_bt.tx;
542 accum_tx = &priv->_agn.accum_statistics_bt.tx; 539 accum_tx = &priv->_agn.accum_statistics_bt.tx;
543 delta_tx = &priv->_agn.delta_statistics_bt.tx; 540 delta_tx = &priv->_agn.delta_statistics_bt.tx;
@@ -737,8 +734,7 @@ ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
737 * the last statistics notification from uCode 734 * the last statistics notification from uCode
738 * might not reflect the current uCode activity 735 * might not reflect the current uCode activity
739 */ 736 */
740 if (priv->cfg->bt_params && 737 if (iwl_bt_statistics(priv)) {
741 priv->cfg->bt_params->bt_statistics) {
742 general = &priv->_agn.statistics_bt.general.common; 738 general = &priv->_agn.statistics_bt.general.common;
743 dbg = &priv->_agn.statistics_bt.general.common.dbg; 739 dbg = &priv->_agn.statistics_bt.general.common.dbg;
744 div = &priv->_agn.statistics_bt.general.common.div; 740 div = &priv->_agn.statistics_bt.general.common.div;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index bbd40b7dd597..b192ca842f0a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -73,8 +73,7 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv)
73 int bcn_silence_a, bcn_silence_b, bcn_silence_c; 73 int bcn_silence_a, bcn_silence_b, bcn_silence_c;
74 int last_rx_noise; 74 int last_rx_noise;
75 75
76 if (priv->cfg->bt_params && 76 if (iwl_bt_statistics(priv))
77 priv->cfg->bt_params->bt_statistics)
78 rx_info = &(priv->_agn.statistics_bt.rx.general.common); 77 rx_info = &(priv->_agn.statistics_bt.rx.general.common);
79 else 78 else
80 rx_info = &(priv->_agn.statistics.rx.general); 79 rx_info = &(priv->_agn.statistics.rx.general);
@@ -125,8 +124,7 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
125 struct statistics_general_common *general, *accum_general; 124 struct statistics_general_common *general, *accum_general;
126 struct statistics_tx *tx, *accum_tx; 125 struct statistics_tx *tx, *accum_tx;
127 126
128 if (priv->cfg->bt_params && 127 if (iwl_bt_statistics(priv)) {
129 priv->cfg->bt_params->bt_statistics) {
130 prev_stats = (__le32 *)&priv->_agn.statistics_bt; 128 prev_stats = (__le32 *)&priv->_agn.statistics_bt;
131 accum_stats = (u32 *)&priv->_agn.accum_statistics_bt; 129 accum_stats = (u32 *)&priv->_agn.accum_statistics_bt;
132 size = sizeof(struct iwl_bt_notif_statistics); 130 size = sizeof(struct iwl_bt_notif_statistics);
@@ -207,8 +205,7 @@ bool iwl_good_plcp_health(struct iwl_priv *priv,
207 struct statistics_rx_phy *ofdm; 205 struct statistics_rx_phy *ofdm;
208 struct statistics_rx_ht_phy *ofdm_ht; 206 struct statistics_rx_ht_phy *ofdm_ht;
209 207
210 if (priv->cfg->bt_params && 208 if (iwl_bt_statistics(priv)) {
211 priv->cfg->bt_params->bt_statistics) {
212 ofdm = &pkt->u.stats_bt.rx.ofdm; 209 ofdm = &pkt->u.stats_bt.rx.ofdm;
213 ofdm_ht = &pkt->u.stats_bt.rx.ofdm_ht; 210 ofdm_ht = &pkt->u.stats_bt.rx.ofdm_ht;
214 combined_plcp_delta = 211 combined_plcp_delta =
@@ -265,8 +262,7 @@ void iwl_rx_statistics(struct iwl_priv *priv,
265 int change; 262 int change;
266 struct iwl_rx_packet *pkt = rxb_addr(rxb); 263 struct iwl_rx_packet *pkt = rxb_addr(rxb);
267 264
268 if (priv->cfg->bt_params && 265 if (iwl_bt_statistics(priv)) {
269 priv->cfg->bt_params->bt_statistics) {
270 IWL_DEBUG_RX(priv, 266 IWL_DEBUG_RX(priv,
271 "Statistics notification received (%d vs %d).\n", 267 "Statistics notification received (%d vs %d).\n",
272 (int)sizeof(struct iwl_bt_notif_statistics), 268 (int)sizeof(struct iwl_bt_notif_statistics),
@@ -304,8 +300,7 @@ void iwl_rx_statistics(struct iwl_priv *priv,
304 300
305 iwl_recover_from_statistics(priv, pkt); 301 iwl_recover_from_statistics(priv, pkt);
306 302
307 if (priv->cfg->bt_params && 303 if (iwl_bt_statistics(priv))
308 priv->cfg->bt_params->bt_statistics)
309 memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt, 304 memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt,
310 sizeof(priv->_agn.statistics_bt)); 305 sizeof(priv->_agn.statistics_bt));
311 else 306 else
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index eb16647cfbe0..646ccb2430b4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3077,8 +3077,7 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
3077 } 3077 }
3078 3078
3079 if (priv->start_calib) { 3079 if (priv->start_calib) {
3080 if (priv->cfg->bt_params && 3080 if (iwl_bt_statistics(priv)) {
3081 priv->cfg->bt_params->bt_statistics) {
3082 iwl_chain_noise_calibration(priv, 3081 iwl_chain_noise_calibration(priv,
3083 (void *)&priv->_agn.statistics_bt); 3082 (void *)&priv->_agn.statistics_bt);
3084 iwl_sensitivity_calibration(priv, 3083 iwl_sensitivity_calibration(priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 705711a01b17..c83fcc60ccc5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -747,6 +747,11 @@ static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv)
747 priv->cfg->bt_params->advanced_bt_coexist; 747 priv->cfg->bt_params->advanced_bt_coexist;
748} 748}
749 749
750static inline bool iwl_bt_statistics(struct iwl_priv *priv)
751{
752 return priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics;
753}
754
750extern bool bt_coex_active; 755extern bool bt_coex_active;
751extern bool bt_siso_mode; 756extern bool bt_siso_mode;
752 757
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index bde16acb08ca..bdcb74279f1e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -1765,7 +1765,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
1765 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); 1765 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR);
1766 if (priv->cfg->base_params->ucode_tracing) 1766 if (priv->cfg->base_params->ucode_tracing)
1767 DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); 1767 DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR);
1768 if (priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics) 1768 if (iwl_bt_statistics(priv))
1769 DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR); 1769 DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR);
1770 DEBUGFS_ADD_FILE(reply_tx_error, dir_debug, S_IRUSR); 1770 DEBUGFS_ADD_FILE(reply_tx_error, dir_debug, S_IRUSR);
1771 DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); 1771 DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR);