iwlwifi: mvm: remove newline from rs_pretty_print_rate()

Some of the places using this want the newline, but not all,
so remove the newline from it and generate it in the debugfs
files where it's desired.

The effect of this is not printing double newlines in debug
log messages.

Change-Id: Ia59b0abbef16b6783fcabc095c5fde16bd047a26
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
Johannes Berg 2019-11-26 11:25:28 +01:00 committed by Luca Coelho
parent 7216dc99b7
commit 84acc85a62
2 changed files with 8 additions and 2 deletions

View File

@ -461,6 +461,8 @@ static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf,
desc += rs_pretty_print_rate(buff + desc, bufsz - desc, desc += rs_pretty_print_rate(buff + desc, bufsz - desc,
lq_sta->last_rate_n_flags); lq_sta->last_rate_n_flags);
if (desc < bufsz - 1)
buff[desc++] = '\n';
mutex_unlock(&mvm->mutex); mutex_unlock(&mvm->mutex);
ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
@ -1013,6 +1015,8 @@ static ssize_t iwl_dbgfs_frame_stats_read(struct iwl_mvm *mvm,
(int)(ARRAY_SIZE(stats->last_rates) - i)); (int)(ARRAY_SIZE(stats->last_rates) - i));
pos += rs_pretty_print_rate(pos, endpos - pos, pos += rs_pretty_print_rate(pos, endpos - pos,
stats->last_rates[idx]); stats->last_rates[idx]);
if (pos < endpos - 1)
*pos++ = '\n';
} }
spin_unlock_bh(&mvm->drv_stats_lock); spin_unlock_bh(&mvm->drv_stats_lock);

View File

@ -3697,7 +3697,7 @@ int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate)
!(rate & RATE_MCS_HE_MSK)) { !(rate & RATE_MCS_HE_MSK)) {
int index = iwl_hwrate_to_plcp_idx(rate); int index = iwl_hwrate_to_plcp_idx(rate);
return scnprintf(buf, bufsz, "Legacy | ANT: %s Rate: %s Mbps\n", return scnprintf(buf, bufsz, "Legacy | ANT: %s Rate: %s Mbps",
rs_pretty_ant(ant), rs_pretty_ant(ant),
index == IWL_RATE_INVALID ? "BAD" : index == IWL_RATE_INVALID ? "BAD" :
iwl_rate_mcs[index].mbps); iwl_rate_mcs[index].mbps);
@ -3740,7 +3740,7 @@ int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate)
} }
return scnprintf(buf, bufsz, return scnprintf(buf, bufsz,
"0x%x: %s | ANT: %s BW: %s MCS: %d NSS: %d %s%s%s%s\n", "0x%x: %s | ANT: %s BW: %s MCS: %d NSS: %d %s%s%s%s",
rate, type, rs_pretty_ant(ant), bw, mcs, nss, rate, type, rs_pretty_ant(ant), bw, mcs, nss,
(rate & RATE_MCS_SGI_MSK) ? "SGI " : "NGI ", (rate & RATE_MCS_SGI_MSK) ? "SGI " : "NGI ",
(rate & RATE_MCS_STBC_MSK) ? "STBC " : "", (rate & RATE_MCS_STBC_MSK) ? "STBC " : "",
@ -3888,6 +3888,8 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
desc += scnprintf(buff + desc, bufsz - desc, desc += scnprintf(buff + desc, bufsz - desc,
" rate[%d] 0x%X ", i, r); " rate[%d] 0x%X ", i, r);
desc += rs_pretty_print_rate(buff + desc, bufsz - desc, r); desc += rs_pretty_print_rate(buff + desc, bufsz - desc, r);
if (desc < bufsz - 1)
buff[desc++] = '\n';
} }
ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);