iwlwifi: mvm: remove newline from rs_pretty_print_rate()
authorJohannes Berg <johannes.berg@intel.com>
Tue, 26 Nov 2019 10:25:28 +0000 (11:25 +0100)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 27 Mar 2020 06:12:53 +0000 (08:12 +0200)
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>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
drivers/net/wireless/intel/iwlwifi/mvm/rs.c

index 190cf15b825ce25b22fb7e93a483c822ad05fd78..3beef8d077b82efeca138c00460a668a30a575b3 100644 (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,
                                     lq_sta->last_rate_n_flags);
+       if (desc < bufsz - 1)
+               buff[desc++] = '\n';
        mutex_unlock(&mvm->mutex);
 
        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));
                pos += rs_pretty_print_rate(pos, endpos - pos,
                                            stats->last_rates[idx]);
+               if (pos < endpos - 1)
+                       *pos++ = '\n';
        }
        spin_unlock_bh(&mvm->drv_stats_lock);
 
index 1a990ed9c3ca6c1333d10864591fd931ccff6423..c1aba2bf73cff4b0732d76f21b05fa8c79ee22ad 100644 (file)
@@ -3697,7 +3697,7 @@ int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate)
            !(rate & RATE_MCS_HE_MSK)) {
                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),
                                 index == IWL_RATE_INVALID ? "BAD" :
                                 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,
-                        "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 & RATE_MCS_SGI_MSK) ? "SGI " : "NGI ",
                         (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,
                                  " rate[%d] 0x%X ", i, 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);