2023-06-19 10:20:52

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH] wifi: iwlfifi: fix -Wunused-const-variable gcc warning

Fix the following gcc 13.1 warning observed with W=1:

drivers/net/wireless/intel/iwlwifi/dvm/rs.c:207:39: warning:
‘iwl_rate_mcs’ defined but not used [-Wunused-const-variable=]

This table is actually used in 'rs_sta_dbgfs_scale_table_read()'
only if CONFIG_MAC80211_DEBUGFS is enabled.

Signed-off-by: Dmitry Antipov <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
index 687c906a9d72..ecad7403ec96 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
@@ -203,6 +203,8 @@ static const u16 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = {
{0, 0, 0, 0, 277, 0, 478, 624, 737, 911, 1026, 1070, 1109}, /* AGG+SGI */
};

+#ifdef CONFIG_MAC80211_DEBUGFS
+
/* mbps, mcs */
static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
{ "1", "BPSK DSSS"},
@@ -220,6 +222,8 @@ static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
{ "60", "64QAM 5/6"},
};

+#endif
+
#define MCS_INDEX_PER_STREAM (8)

static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
--
2.41.0



2023-06-19 10:35:59

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] wifi: iwlfifi: fix -Wunused-const-variable gcc warning

On Mon, 2023-06-19 at 13:00 +0300, Dmitry Antipov wrote:
> Fix the following gcc 13.1 warning observed with W=1:
>
> drivers/net/wireless/intel/iwlwifi/dvm/rs.c:207:39: warning:
> ‘iwl_rate_mcs’ defined but not used [-Wunused-const-variable=]
>
> This table is actually used in 'rs_sta_dbgfs_scale_table_read()'
> only if CONFIG_MAC80211_DEBUGFS is enabled.
>
> Signed-off-by: Dmitry Antipov <[email protected]>
> ---
> drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
> index 687c906a9d72..ecad7403ec96 100644
> --- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
> +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
> @@ -203,6 +203,8 @@ static const u16 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = {
> {0, 0, 0, 0, 277, 0, 478, 624, 737, 911, 1026, 1070, 1109}, /* AGG+SGI */
> };
>
> +#ifdef CONFIG_MAC80211_DEBUGFS
> +
> /* mbps, mcs */
> static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
>

Maybe move it to the existing ifdef, or even into the function?

Also, you have a typo in subject, 'iwlwifi', but should probably be
"wifi: iwlwifi: dvm: ..." since dvm/mvm are hugely different.

johannes

2023-06-19 10:37:23

by Greenman, Gregory

[permalink] [raw]
Subject: Re: [PATCH] wifi: iwlfifi: fix -Wunused-const-variable gcc warning

On Mon, 2023-06-19 at 13:00 +0300, Dmitry Antipov wrote:
> Fix the following gcc 13.1 warning observed with W=1:
>
> drivers/net/wireless/intel/iwlwifi/dvm/rs.c:207:39: warning:
> ‘iwl_rate_mcs’ defined but not used [-Wunused-const-variable=]
>
> This table is actually used in 'rs_sta_dbgfs_scale_table_read()'
> only if CONFIG_MAC80211_DEBUGFS is enabled.
>
> Signed-off-by: Dmitry Antipov <[email protected]>
> ---
>  drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
> index 687c906a9d72..ecad7403ec96 100644
> --- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
> +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
> @@ -203,6 +203,8 @@ static const u16 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = {
>         {0, 0, 0, 0, 277, 0, 478, 624, 737, 911, 1026, 1070, 1109}, /* AGG+SGI */
>  };
>  
> +#ifdef CONFIG_MAC80211_DEBUGFS
> +
>  /* mbps, mcs */
>  static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
>         {  "1", "BPSK DSSS"},
> @@ -220,6 +222,8 @@ static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
>         { "60", "64QAM 5/6"},
>  };
>  
> +#endif
> +
>  #define MCS_INDEX_PER_STREAM   (8)
>  
>  static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)

Johannes, could you please take it directly to wireless-next? Or you prefer me
to send it with the next set of iwlwifi patches?

Acked-by: Gregory Greenman <[email protected]>

2023-06-19 10:37:33

by Greenman, Gregory

[permalink] [raw]
Subject: Re: [PATCH] wifi: iwlfifi: fix -Wunused-const-variable gcc warning

On Mon, 2023-06-19 at 10:32 +0000, Greenman, Gregory wrote:
> On Mon, 2023-06-19 at 13:00 +0300, Dmitry Antipov wrote:
> > Fix the following gcc 13.1 warning observed with W=1:
> >
> > drivers/net/wireless/intel/iwlwifi/dvm/rs.c:207:39: warning:
> > ‘iwl_rate_mcs’ defined but not used [-Wunused-const-variable=]
> >
> > This table is actually used in 'rs_sta_dbgfs_scale_table_read()'
> > only if CONFIG_MAC80211_DEBUGFS is enabled.
> >
> > Signed-off-by: Dmitry Antipov <[email protected]>
> > ---
> >  drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
> > index 687c906a9d72..ecad7403ec96 100644
> > --- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
> > +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
> > @@ -203,6 +203,8 @@ static const u16 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = {
> >         {0, 0, 0, 0, 277, 0, 478, 624, 737, 911, 1026, 1070, 1109}, /* AGG+SGI */
> >  };
> >  
> > +#ifdef CONFIG_MAC80211_DEBUGFS
> > +
> >  /* mbps, mcs */
> >  static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
> >         {  "1", "BPSK DSSS"},
> > @@ -220,6 +222,8 @@ static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
> >         { "60", "64QAM 5/6"},
> >  };
> >  
> > +#endif
> > +
> >  #define MCS_INDEX_PER_STREAM   (8)
> >  
> >  static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
>
> Johannes, could you please take it directly to wireless-next? Or you prefer me
> to send it with the next set of iwlwifi patches?
>
> Acked-by: Gregory Greenman <[email protected]>

Just noticed your comments, so ignore it...

2023-06-19 10:44:49

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH] [v2] wifi: iwlwifi: dvm: fix -Wunused-const-variable gcc warning

Fix the following gcc 13.1 warning observed with W=1:

drivers/net/wireless/intel/iwlwifi/dvm/rs.c:207:39: warning:
‘iwl_rate_mcs’ defined but not used [-Wunused-const-variable=]

This table is actually used in 'rs_sta_dbgfs_scale_table_read()'
only if CONFIG_MAC80211_DEBUGFS is enabled, so the whole thing
may be moved close to its actual use.

Signed-off-by: Dmitry Antipov <[email protected]>
---
v2: fix title and move iwl_rate_mcs to rs_sta_dbgfs_scale_table_read() (Johannes Berg)
---
drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 34 ++++++++++-----------
1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
index 687c906a9d72..e0c3563da8a2 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
@@ -203,23 +203,6 @@ static const u16 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = {
{0, 0, 0, 0, 277, 0, 478, 624, 737, 911, 1026, 1070, 1109}, /* AGG+SGI */
};

-/* mbps, mcs */
-static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
- { "1", "BPSK DSSS"},
- { "2", "QPSK DSSS"},
- {"5.5", "BPSK CCK"},
- { "11", "QPSK CCK"},
- { "6", "BPSK 1/2"},
- { "9", "BPSK 1/2"},
- { "12", "QPSK 1/2"},
- { "18", "QPSK 3/4"},
- { "24", "16QAM 1/2"},
- { "36", "16QAM 3/4"},
- { "48", "64QAM 2/3"},
- { "54", "64QAM 3/4"},
- { "60", "64QAM 5/6"},
-};
-
#define MCS_INDEX_PER_STREAM (8)

static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
@@ -3089,6 +3072,23 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
int index = 0;
ssize_t ret;

+ /* mbps, mcs */
+ static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
+ { "1", "BPSK DSSS"},
+ { "2", "QPSK DSSS"},
+ {"5.5", "BPSK CCK"},
+ { "11", "QPSK CCK"},
+ { "6", "BPSK 1/2"},
+ { "9", "BPSK 1/2"},
+ { "12", "QPSK 1/2"},
+ { "18", "QPSK 3/4"},
+ { "24", "16QAM 1/2"},
+ { "36", "16QAM 3/4"},
+ { "48", "64QAM 2/3"},
+ { "54", "64QAM 3/4"},
+ { "60", "64QAM 5/6"},
+ };
+
struct iwl_lq_sta *lq_sta = file->private_data;
struct iwl_priv *priv;
struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
--
2.41.0