Re: [PATCH 16/28] wireless: marvell: mwifiex: init: Move 'tos_to_tid_inv' to where it's used

From: Lee Jones
Date: Tue Sep 08 2020 - 13:42:48 EST


On Tue, 08 Sep 2020, Kalle Valo wrote:

> Lee Jones <lee.jones@xxxxxxxxxx> writes:
>
> > On Mon, 31 Aug 2020, Kalle Valo wrote:
> >
> >> Lee Jones <lee.jones@xxxxxxxxxx> 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@xxxxxxxxx>
> >> > Cc: Ganapathi Bhat <ganapathi.bhat@xxxxxxx>
> >> > Cc: Xinming Hu <huxinming820@xxxxxxxxx>
> >> > Cc: Kalle Valo <kvalo@xxxxxxxxxxxxxx>
> >> > Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
> >> > Cc: Jakub Kicinski <kuba@xxxxxxxxxx>
> >> > Cc: linux-wireless@xxxxxxxxxxxxxxx
> >> > Cc: netdev@xxxxxxxxxxxxxxx
> >> > Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>
> >>
> >> 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?

--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog