On Wed, 2019-05-29 at 15:54 +0800, [email protected] wrote:
> From: Zong-Zhe Yang <[email protected]>
>
> Add a read entry in debugfs to dump current tx power
> indexes in use for each path and each rate section.
> The corresponding power bases, power by rate, and
> power limit are also included.
>
> Signed-off-by: Zong-Zhe Yang <[email protected]>
> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
> ---
> drivers/net/wireless/realtek/rtw88/debug.c | 112
> +++++++++++++++++++++++++++++
> 1 file changed, 112 insertions(+)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/debug.c
> b/drivers/net/wireless/realtek/rtw88/debug.c
> index f0ae260..ee2937c2 100644
> --- a/drivers/net/wireless/realtek/rtw88/debug.c
> +++ b/drivers/net/wireless/realtek/rtw88/debug.c
> @@ -8,6 +8,7 @@
> #include "sec.h"
> #include "fw.h"
> #include "debug.h"
> +#include "phy.h"
>
> #ifdef CONFIG_RTW88_DEBUGFS
>
> @@ -460,6 +461,112 @@ static int rtw_debug_get_rf_dump(struct seq_file *m,
> void *v)
> return 0;
> }
>
> +static void rtw_print_cck_rate_txt(struct seq_file *m, u8 rate)
> +{
> + static const char * const
> + cck_rate[] = {"1M", "2M", "5.5M", "11M"};
> + u8 idx = rate - DESC_RATE1M;
> +
> + seq_printf(m, "%5s%-5s", "CCK_", cck_rate[idx]);
Why use %5s instead of just embedding the prefix directly?
Also why use %5s at all when the length is 4?
I think it'd be more sensible as:
seq_printf(m, " CCK_%-5s", cck_rate[idx]);
> +}
> +
> +static void rtw_print_ofdm_rate_txt(struct seq_file *m, u8 rate)
> +{
> + static const char * const
> + ofdm_rate[] = {"6M", "9M", "12M", "18M", "24M", "36M", "48M", "54M"};
> + u8 idx = rate - DESC_RATE6M;
> +
> + seq_printf(m, "%6s%-4s", "OFDM_", ofdm_rate[idx]);
here too
> +}
> +
> +static void rtw_print_ht_rate_txt(struct seq_file *m, u8 rate)
> +{
> + u8 mcs_n = rate - DESC_RATEMCS0;
> +
> + seq_printf(m, "%4s%-6u", "MCS", mcs_n);
and here, etc...