Message ID | 20200819072402.3085022-17-lee.jones@linaro.org (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Kalle Valo |
Headers | show |
Series | Rid W=1 warnings in Wireless | expand |
Lee Jones <lee.jones@linaro.org> wrote: > 'tos_to_tid_inv' is only used in 2 of 17 files it's current being > included into. > > Fixes the following W=1 kernel build warning(s): > > In file included from drivers/net/wireless/marvell/mwifiex/main.c:23: > In file included from drivers/net/wireless/marvell/mwifiex/cmdevt.c:26: > In file included from drivers/net/wireless/marvell/mwifiex/util.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/txrx.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/11n.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/wmm.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/11n_aggr.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/join.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/sta_cmd.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/sta_ioctl.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/sta_event.c:25: > In file included from drivers/net/wireless/marvell/mwifiex/uap_txrx.c:23: > In file included from drivers/net/wireless/marvell/mwifiex/sdio.c:27: > In file included from drivers/net/wireless/marvell/mwifiex/sta_tx.c:25: > drivers/net/wireless/marvell/mwifiex/wmm.h:41:17: warning: ‘tos_to_tid_inv’ defined but not used [-Wunused-const-variable=] > 41 | static const u8 tos_to_tid_inv[] = { > > NB: Snipped for brevity > > Cc: Amitkumar Karwar <amitkarwar@gmail.com> > Cc: Ganapathi Bhat <ganapathi.bhat@nxp.com> > Cc: Xinming Hu <huxinming820@gmail.com> > Cc: Kalle Valo <kvalo@codeaurora.org> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: linux-wireless@vger.kernel.org > Cc: netdev@vger.kernel.org > Signed-off-by: Lee Jones <lee.jones@linaro.org> The patch creates two duplicate arrays, this makes it worse than it was before. Patch set to Changes Requested.
On Mon, 31 Aug 2020, Kalle Valo wrote: > Lee Jones <lee.jones@linaro.org> wrote: > > > 'tos_to_tid_inv' is only used in 2 of 17 files it's current being > > included into. > > > > Fixes the following W=1 kernel build warning(s): > > > > In file included from drivers/net/wireless/marvell/mwifiex/main.c:23: > > In file included from drivers/net/wireless/marvell/mwifiex/cmdevt.c:26: > > In file included from drivers/net/wireless/marvell/mwifiex/util.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/txrx.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/11n.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/wmm.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/11n_aggr.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/join.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/sta_cmd.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/sta_ioctl.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/sta_event.c:25: > > In file included from drivers/net/wireless/marvell/mwifiex/uap_txrx.c:23: > > In file included from drivers/net/wireless/marvell/mwifiex/sdio.c:27: > > In file included from drivers/net/wireless/marvell/mwifiex/sta_tx.c:25: > > drivers/net/wireless/marvell/mwifiex/wmm.h:41:17: warning: ‘tos_to_tid_inv’ defined but not used [-Wunused-const-variable=] > > 41 | static const u8 tos_to_tid_inv[] = { > > > > NB: Snipped for brevity > > > > Cc: Amitkumar Karwar <amitkarwar@gmail.com> > > Cc: Ganapathi Bhat <ganapathi.bhat@nxp.com> > > Cc: Xinming Hu <huxinming820@gmail.com> > > Cc: Kalle Valo <kvalo@codeaurora.org> > > Cc: "David S. Miller" <davem@davemloft.net> > > Cc: Jakub Kicinski <kuba@kernel.org> > > Cc: linux-wireless@vger.kernel.org > > Cc: netdev@vger.kernel.org > > Signed-off-by: Lee Jones <lee.jones@linaro.org> > > The patch creates two duplicate arrays, this makes it worse than it was > before. We have a choice (and you don't like either of them). :) Either add the variable into the file(s) they are used or tell the compiler that it's okay for other files to declare but not used them (mark as __maybe_unused). What is your preferred solution?
Lee Jones <lee.jones@linaro.org> writes: > On Mon, 31 Aug 2020, Kalle Valo wrote: > >> Lee Jones <lee.jones@linaro.org> wrote: >> >> > 'tos_to_tid_inv' is only used in 2 of 17 files it's current being >> > included into. >> > >> > Fixes the following W=1 kernel build warning(s): >> > >> > In file included from drivers/net/wireless/marvell/mwifiex/main.c:23: >> > In file included from drivers/net/wireless/marvell/mwifiex/cmdevt.c:26: >> > In file included from drivers/net/wireless/marvell/mwifiex/util.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/txrx.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/11n.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/wmm.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/11n_aggr.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/join.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/sta_cmd.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/sta_ioctl.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/sta_event.c:25: >> > In file included from drivers/net/wireless/marvell/mwifiex/uap_txrx.c:23: >> > In file included from drivers/net/wireless/marvell/mwifiex/sdio.c:27: >> > In file included from drivers/net/wireless/marvell/mwifiex/sta_tx.c:25: >> > drivers/net/wireless/marvell/mwifiex/wmm.h:41:17: warning: >> > ‘tos_to_tid_inv’ defined but not used [-Wunused-const-variable=] >> > 41 | static const u8 tos_to_tid_inv[] = { >> > >> > NB: Snipped for brevity >> > >> > Cc: Amitkumar Karwar <amitkarwar@gmail.com> >> > Cc: Ganapathi Bhat <ganapathi.bhat@nxp.com> >> > Cc: Xinming Hu <huxinming820@gmail.com> >> > Cc: Kalle Valo <kvalo@codeaurora.org> >> > Cc: "David S. Miller" <davem@davemloft.net> >> > Cc: Jakub Kicinski <kuba@kernel.org> >> > Cc: linux-wireless@vger.kernel.org >> > Cc: netdev@vger.kernel.org >> > Signed-off-by: Lee Jones <lee.jones@linaro.org> >> >> The patch creates two duplicate arrays, this makes it worse than it was >> before. > > We have a choice (and you don't like either of them). :) > > Either add the variable into the file(s) they are used or tell the > compiler that it's okay for other files to declare but not used them > (mark as __maybe_unused). > > What is your preferred solution? Yue already sent a patch for this (at least I think so, not 100% sure if this is the same case): https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=d56ee19a148edaa9972ca12f817e395ba436078b But that's the solution I like :) There's only one array and it's shared by all the users.
On Tue, 08 Sep 2020, Kalle Valo wrote: > Lee Jones <lee.jones@linaro.org> writes: > > > On Mon, 31 Aug 2020, Kalle Valo wrote: > > > >> Lee Jones <lee.jones@linaro.org> wrote: > >> > >> > 'tos_to_tid_inv' is only used in 2 of 17 files it's current being > >> > included into. > >> > > >> > Fixes the following W=1 kernel build warning(s): > >> > > >> > In file included from drivers/net/wireless/marvell/mwifiex/main.c:23: > >> > In file included from drivers/net/wireless/marvell/mwifiex/cmdevt.c:26: > >> > In file included from drivers/net/wireless/marvell/mwifiex/util.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/txrx.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/11n.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/wmm.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/11n_aggr.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/join.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/sta_cmd.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/sta_ioctl.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/sta_event.c:25: > >> > In file included from drivers/net/wireless/marvell/mwifiex/uap_txrx.c:23: > >> > In file included from drivers/net/wireless/marvell/mwifiex/sdio.c:27: > >> > In file included from drivers/net/wireless/marvell/mwifiex/sta_tx.c:25: > >> > drivers/net/wireless/marvell/mwifiex/wmm.h:41:17: warning: > >> > ‘tos_to_tid_inv’ defined but not used [-Wunused-const-variable=] > >> > 41 | static const u8 tos_to_tid_inv[] = { > >> > > >> > NB: Snipped for brevity > >> > > >> > Cc: Amitkumar Karwar <amitkarwar@gmail.com> > >> > Cc: Ganapathi Bhat <ganapathi.bhat@nxp.com> > >> > Cc: Xinming Hu <huxinming820@gmail.com> > >> > Cc: Kalle Valo <kvalo@codeaurora.org> > >> > Cc: "David S. Miller" <davem@davemloft.net> > >> > Cc: Jakub Kicinski <kuba@kernel.org> > >> > Cc: linux-wireless@vger.kernel.org > >> > Cc: netdev@vger.kernel.org > >> > Signed-off-by: Lee Jones <lee.jones@linaro.org> > >> > >> The patch creates two duplicate arrays, this makes it worse than it was > >> before. > > > > We have a choice (and you don't like either of them). :) > > > > Either add the variable into the file(s) they are used or tell the > > compiler that it's okay for other files to declare but not used them > > (mark as __maybe_unused). > > > > What is your preferred solution? > > Yue already sent a patch for this (at least I think so, not 100% sure if > this is the same case): > > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=d56ee19a148edaa9972ca12f817e395ba436078b > > But that's the solution I like :) There's only one array and it's shared > by all the users. Any idea if this results in anything different from making use of __maybe_unused once compiled?
diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index 82d69bc3aaaf4..7ffc78b258317 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -25,6 +25,22 @@ #include "wmm.h" #include "11n.h" +/* + * This table inverses the tos_to_tid operation to get a priority + * which is in sequential order, and can be compared. + * Use this to compare the priority of two different TIDs. + */ +static const u8 tos_to_tid_inv[] = { + 0x02, /* from tos_to_tid[2] = 0 */ + 0x00, /* from tos_to_tid[0] = 1 */ + 0x01, /* from tos_to_tid[1] = 2 */ + 0x03, + 0x04, + 0x05, + 0x06, + 0x07 +}; + /* * This function adds a BSS priority table to the table list. * diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c b/drivers/net/wireless/marvell/mwifiex/tdls.c index 97bb87c3676bb..35c02b149820d 100644 --- a/drivers/net/wireless/marvell/mwifiex/tdls.c +++ b/drivers/net/wireless/marvell/mwifiex/tdls.c @@ -27,6 +27,22 @@ #define TDLS_CONFIRM_FIX_LEN 6 #define MWIFIEX_TDLS_WMM_INFO_SIZE 7 +/* + * This table inverses the tos_to_tid operation to get a priority + * which is in sequential order, and can be compared. + * Use this to compare the priority of two different TIDs. + */ +static const u8 tos_to_tid_inv[] = { + 0x02, /* from tos_to_tid[2] = 0 */ + 0x00, /* from tos_to_tid[0] = 1 */ + 0x01, /* from tos_to_tid[1] = 2 */ + 0x03, + 0x04, + 0x05, + 0x06, + 0x07 +}; + static void mwifiex_restore_tdls_packets(struct mwifiex_private *priv, const u8 *mac, u8 status) { diff --git a/drivers/net/wireless/marvell/mwifiex/wmm.h b/drivers/net/wireless/marvell/mwifiex/wmm.h index 04d7da95e3078..60bdbb82277a3 100644 --- a/drivers/net/wireless/marvell/mwifiex/wmm.h +++ b/drivers/net/wireless/marvell/mwifiex/wmm.h @@ -33,21 +33,6 @@ enum ieee_types_wmm_ecw_bitmasks { static const u16 mwifiex_1d_to_wmm_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; -/* - * This table inverses the tos_to_tid operation to get a priority - * which is in sequential order, and can be compared. - * Use this to compare the priority of two different TIDs. - */ -static const u8 tos_to_tid_inv[] = { - 0x02, /* from tos_to_tid[2] = 0 */ - 0x00, /* from tos_to_tid[0] = 1 */ - 0x01, /* from tos_to_tid[1] = 2 */ - 0x03, - 0x04, - 0x05, - 0x06, - 0x07}; - /* * This function retrieves the TID of the given RA list. */
'tos_to_tid_inv' is only used in 2 of 17 files it's current being included into. Fixes the following W=1 kernel build warning(s): In file included from drivers/net/wireless/marvell/mwifiex/main.c:23: In file included from drivers/net/wireless/marvell/mwifiex/cmdevt.c:26: In file included from drivers/net/wireless/marvell/mwifiex/util.c:25: In file included from drivers/net/wireless/marvell/mwifiex/txrx.c:25: In file included from drivers/net/wireless/marvell/mwifiex/11n.c:25: In file included from drivers/net/wireless/marvell/mwifiex/wmm.c:25: In file included from drivers/net/wireless/marvell/mwifiex/11n_aggr.c:25: In file included from drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c:25: In file included from drivers/net/wireless/marvell/mwifiex/join.c:25: In file included from drivers/net/wireless/marvell/mwifiex/sta_cmd.c:25: In file included from drivers/net/wireless/marvell/mwifiex/sta_ioctl.c:25: In file included from drivers/net/wireless/marvell/mwifiex/sta_event.c:25: In file included from drivers/net/wireless/marvell/mwifiex/uap_txrx.c:23: In file included from drivers/net/wireless/marvell/mwifiex/sdio.c:27: In file included from drivers/net/wireless/marvell/mwifiex/sta_tx.c:25: drivers/net/wireless/marvell/mwifiex/wmm.h:41:17: warning: ‘tos_to_tid_inv’ defined but not used [-Wunused-const-variable=] 41 | static const u8 tos_to_tid_inv[] = { NB: Snipped for brevity Cc: Amitkumar Karwar <amitkarwar@gmail.com> Cc: Ganapathi Bhat <ganapathi.bhat@nxp.com> Cc: Xinming Hu <huxinming820@gmail.com> Cc: Kalle Valo <kvalo@codeaurora.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jakub Kicinski <kuba@kernel.org> Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/net/wireless/marvell/mwifiex/init.c | 16 ++++++++++++++++ drivers/net/wireless/marvell/mwifiex/tdls.c | 16 ++++++++++++++++ drivers/net/wireless/marvell/mwifiex/wmm.h | 15 --------------- 3 files changed, 32 insertions(+), 15 deletions(-)