Re: [PATCH] mwifiex: pcie: Fix -Wunused-const-variable warnings

From: Yuehaibing
Date: Mon Sep 07 2020 - 05:41:06 EST



commit 77dacc8fc64c ("mwifiex: pcie: Move tables to the only place they're used")

do the same things.

On 2020/9/7 16:34, Kalle Valo wrote:
> YueHaibing <yuehaibing@xxxxxxxxxx> wrote:
>
>> These variables only used in pcie.c, move them to .c file
>> can silence these warnings:
>>
>> In file included from drivers/net/wireless/marvell/mwifiex/main.h:57:0,
>> from drivers/net/wireless/marvell/mwifiex/init.c:24:
>> drivers/net/wireless/marvell/mwifiex/pcie.h:310:41: warning: mwifiex_pcie8997 defined but not used [-Wunused-const-variable=]
>> static const struct mwifiex_pcie_device mwifiex_pcie8997 = {
>> ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/marvell/mwifiex/pcie.h:300:41: warning: mwifiex_pcie8897 defined but not used [-Wunused-const-variable=]
>> static const struct mwifiex_pcie_device mwifiex_pcie8897 = {
>> ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/marvell/mwifiex/pcie.h:292:41: warning: mwifiex_pcie8766 defined but not used [-Wunused-const-variable=]
>> static const struct mwifiex_pcie_device mwifiex_pcie8766 = {
>> ^~~~~~~~~~~~~~~~
>>
>> Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
>
> Failed to build:
>
> drivers/net/wireless/marvell/mwifiex/pcie.c:191:43: error: redefinition of 'mwifiex_reg_8766'
> 191 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:36:43: note: previous definition of 'mwifiex_reg_8766' was here
> 36 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:223:43: error: redefinition of 'mwifiex_reg_8897'
> 223 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:68:43: note: previous definition of 'mwifiex_reg_8897' was here
> 68 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:260:43: error: redefinition of 'mwifiex_reg_8997'
> 260 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8997 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:105:43: note: previous definition of 'mwifiex_reg_8997' was here
> 105 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8997 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:297:35: error: redefinition of 'mem_type_mapping_tbl_w8897'
> 297 | static struct memory_type_mapping mem_type_mapping_tbl_w8897[] = {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:142:35: note: previous definition of 'mem_type_mapping_tbl_w8897' was here
> 142 | static struct memory_type_mapping mem_type_mapping_tbl_w8897[] = {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:308:35: error: redefinition of 'mem_type_mapping_tbl_w8997'
> 308 | static struct memory_type_mapping mem_type_mapping_tbl_w8997[] = {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:153:35: note: previous definition of 'mem_type_mapping_tbl_w8997' was here
> 153 | static struct memory_type_mapping mem_type_mapping_tbl_w8997[] = {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:312:41: error: redefinition of 'mwifiex_pcie8766'
> 312 | static const struct mwifiex_pcie_device mwifiex_pcie8766 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:157:41: note: previous definition of 'mwifiex_pcie8766' was here
> 157 | static const struct mwifiex_pcie_device mwifiex_pcie8766 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:320:41: error: redefinition of 'mwifiex_pcie8897'
> 320 | static const struct mwifiex_pcie_device mwifiex_pcie8897 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:165:41: note: previous definition of 'mwifiex_pcie8897' was here
> 165 | static const struct mwifiex_pcie_device mwifiex_pcie8897 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:330:41: error: redefinition of 'mwifiex_pcie8997'
> 330 | static const struct mwifiex_pcie_device mwifiex_pcie8997 = {
> | ^~~~~~~~~~~~~~~~
> drivers/net/wireless/marvell/mwifiex/pcie.c:175:41: note: previous definition of 'mwifiex_pcie8997' was here
> 175 | static const struct mwifiex_pcie_device mwifiex_pcie8997 = {
> | ^~~~~~~~~~~~~~~~
> make[5]: *** [drivers/net/wireless/marvell/mwifiex/pcie.o] Error 1
> make[4]: *** [drivers/net/wireless/marvell/mwifiex] Error 2
> make[3]: *** [drivers/net/wireless/marvell] Error 2
> make[2]: *** [drivers/net/wireless] Error 2
> make[1]: *** [drivers/net] Error 2
> make: *** [drivers] Error 2
>
> Patch set to Changes Requested.
>