Commit 9f60e7ee authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville

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: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Acked-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8c9f514b
...@@ -631,8 +631,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp) ...@@ -631,8 +631,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp)
} }
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
rx_info = &(((struct iwl_bt_notif_statistics *)resp)-> rx_info = &(((struct iwl_bt_notif_statistics *)resp)->
rx.general.common); rx.general.common);
ofdm = &(((struct iwl_bt_notif_statistics *)resp)->rx.ofdm); 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,8 +896,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
} }
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
rx_info = &(((struct iwl_bt_notif_statistics *)stat_resp)-> rx_info = &(((struct iwl_bt_notif_statistics *)stat_resp)->
rx.general.common); rx.general.common);
} else { } else {
...@@ -913,8 +911,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) ...@@ -913,8 +911,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK); rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK);
rxon_chnum = le16_to_cpu(ctx->staging.channel); rxon_chnum = le16_to_cpu(ctx->staging.channel);
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
stat_band24 = !!(((struct iwl_bt_notif_statistics *) stat_band24 = !!(((struct iwl_bt_notif_statistics *)
stat_resp)->flag & stat_resp)->flag &
STATISTICS_REPLY_FLG_BAND_24G_MSK); STATISTICS_REPLY_FLG_BAND_24G_MSK);
......
...@@ -39,8 +39,7 @@ static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) ...@@ -39,8 +39,7 @@ static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
int p = 0; int p = 0;
u32 flag; u32 flag;
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv))
priv->cfg->bt_params->bt_statistics)
flag = le32_to_cpu(priv->_agn.statistics_bt.flag); flag = le32_to_cpu(priv->_agn.statistics_bt.flag);
else else
flag = le32_to_cpu(priv->_agn.statistics.flag); 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,8 +88,7 @@ ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
* the last statistics notification from uCode * the last statistics notification from uCode
* might not reflect the current uCode activity * might not reflect the current uCode activity
*/ */
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
ofdm = &priv->_agn.statistics_bt.rx.ofdm; ofdm = &priv->_agn.statistics_bt.rx.ofdm;
cck = &priv->_agn.statistics_bt.rx.cck; cck = &priv->_agn.statistics_bt.rx.cck;
general = &priv->_agn.statistics_bt.rx.general.common; general = &priv->_agn.statistics_bt.rx.general.common;
...@@ -536,8 +534,7 @@ ssize_t iwl_ucode_tx_stats_read(struct file *file, ...@@ -536,8 +534,7 @@ ssize_t iwl_ucode_tx_stats_read(struct file *file,
* the last statistics notification from uCode * the last statistics notification from uCode
* might not reflect the current uCode activity * might not reflect the current uCode activity
*/ */
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
tx = &priv->_agn.statistics_bt.tx; tx = &priv->_agn.statistics_bt.tx;
accum_tx = &priv->_agn.accum_statistics_bt.tx; accum_tx = &priv->_agn.accum_statistics_bt.tx;
delta_tx = &priv->_agn.delta_statistics_bt.tx; 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,8 +734,7 @@ ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
* the last statistics notification from uCode * the last statistics notification from uCode
* might not reflect the current uCode activity * might not reflect the current uCode activity
*/ */
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
general = &priv->_agn.statistics_bt.general.common; general = &priv->_agn.statistics_bt.general.common;
dbg = &priv->_agn.statistics_bt.general.common.dbg; dbg = &priv->_agn.statistics_bt.general.common.dbg;
div = &priv->_agn.statistics_bt.general.common.div; div = &priv->_agn.statistics_bt.general.common.div;
......
...@@ -73,8 +73,7 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv) ...@@ -73,8 +73,7 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv)
int bcn_silence_a, bcn_silence_b, bcn_silence_c; int bcn_silence_a, bcn_silence_b, bcn_silence_c;
int last_rx_noise; int last_rx_noise;
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv))
priv->cfg->bt_params->bt_statistics)
rx_info = &(priv->_agn.statistics_bt.rx.general.common); rx_info = &(priv->_agn.statistics_bt.rx.general.common);
else else
rx_info = &(priv->_agn.statistics.rx.general); rx_info = &(priv->_agn.statistics.rx.general);
...@@ -125,8 +124,7 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv, ...@@ -125,8 +124,7 @@ static void iwl_accumulative_statistics(struct iwl_priv *priv,
struct statistics_general_common *general, *accum_general; struct statistics_general_common *general, *accum_general;
struct statistics_tx *tx, *accum_tx; struct statistics_tx *tx, *accum_tx;
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
prev_stats = (__le32 *)&priv->_agn.statistics_bt; prev_stats = (__le32 *)&priv->_agn.statistics_bt;
accum_stats = (u32 *)&priv->_agn.accum_statistics_bt; accum_stats = (u32 *)&priv->_agn.accum_statistics_bt;
size = sizeof(struct iwl_bt_notif_statistics); size = sizeof(struct iwl_bt_notif_statistics);
...@@ -207,8 +205,7 @@ bool iwl_good_plcp_health(struct iwl_priv *priv, ...@@ -207,8 +205,7 @@ bool iwl_good_plcp_health(struct iwl_priv *priv,
struct statistics_rx_phy *ofdm; struct statistics_rx_phy *ofdm;
struct statistics_rx_ht_phy *ofdm_ht; struct statistics_rx_ht_phy *ofdm_ht;
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
ofdm = &pkt->u.stats_bt.rx.ofdm; ofdm = &pkt->u.stats_bt.rx.ofdm;
ofdm_ht = &pkt->u.stats_bt.rx.ofdm_ht; ofdm_ht = &pkt->u.stats_bt.rx.ofdm_ht;
combined_plcp_delta = combined_plcp_delta =
...@@ -265,8 +262,7 @@ void iwl_rx_statistics(struct iwl_priv *priv, ...@@ -265,8 +262,7 @@ void iwl_rx_statistics(struct iwl_priv *priv,
int change; int change;
struct iwl_rx_packet *pkt = rxb_addr(rxb); struct iwl_rx_packet *pkt = rxb_addr(rxb);
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
IWL_DEBUG_RX(priv, IWL_DEBUG_RX(priv,
"Statistics notification received (%d vs %d).\n", "Statistics notification received (%d vs %d).\n",
(int)sizeof(struct iwl_bt_notif_statistics), (int)sizeof(struct iwl_bt_notif_statistics),
...@@ -304,8 +300,7 @@ void iwl_rx_statistics(struct iwl_priv *priv, ...@@ -304,8 +300,7 @@ void iwl_rx_statistics(struct iwl_priv *priv,
iwl_recover_from_statistics(priv, pkt); iwl_recover_from_statistics(priv, pkt);
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv))
priv->cfg->bt_params->bt_statistics)
memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt, memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt,
sizeof(priv->_agn.statistics_bt)); sizeof(priv->_agn.statistics_bt));
else else
......
...@@ -3077,8 +3077,7 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) ...@@ -3077,8 +3077,7 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
} }
if (priv->start_calib) { if (priv->start_calib) {
if (priv->cfg->bt_params && if (iwl_bt_statistics(priv)) {
priv->cfg->bt_params->bt_statistics) {
iwl_chain_noise_calibration(priv, iwl_chain_noise_calibration(priv,
(void *)&priv->_agn.statistics_bt); (void *)&priv->_agn.statistics_bt);
iwl_sensitivity_calibration(priv, iwl_sensitivity_calibration(priv,
......
...@@ -747,6 +747,11 @@ static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv) ...@@ -747,6 +747,11 @@ static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv)
priv->cfg->bt_params->advanced_bt_coexist; priv->cfg->bt_params->advanced_bt_coexist;
} }
static inline bool iwl_bt_statistics(struct iwl_priv *priv)
{
return priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics;
}
extern bool bt_coex_active; extern bool bt_coex_active;
extern bool bt_siso_mode; extern bool bt_siso_mode;
......
...@@ -1765,7 +1765,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) ...@@ -1765,7 +1765,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR);
if (priv->cfg->base_params->ucode_tracing) if (priv->cfg->base_params->ucode_tracing)
DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR);
if (priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics) if (iwl_bt_statistics(priv))
DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(reply_tx_error, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(reply_tx_error, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment