Skip to contentSkip to conversation

mwifiex: pcie: Fix -Wunused-const-variable warnings

PATCH In review YueHaibing 2 participants 3 messages Sep 2, 2020 – Sep 7, 2020 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 mwifiex: pcie: Fix -Wunused-const-variable warnings

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 = {
                                         ^~~~~~~~~~~~~~~~
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 149 ++++++++++++++++++++
 drivers/net/wireless/marvell/mwifiex/pcie.h | 149 --------------------
 2 files changed, 149 insertions(+), 149 deletions(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +149 -0
index 3c1ad0be70a8..04739cbb74f2 100644
@@ -39,6 +39,155 @@ static const struct of_device_id mwifiex_pcie_of_match_table[] = {
 	{ }
 };
 
+static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = {
+	.cmd_addr_lo = PCIE_SCRATCH_0_REG,
+	.cmd_addr_hi = PCIE_SCRATCH_1_REG,
+	.cmd_size = PCIE_SCRATCH_2_REG,
+	.fw_status = PCIE_SCRATCH_3_REG,
+	.cmdrsp_addr_lo = PCIE_SCRATCH_4_REG,
+	.cmdrsp_addr_hi = PCIE_SCRATCH_5_REG,
+	.tx_rdptr = PCIE_SCRATCH_6_REG,
+	.tx_wrptr = PCIE_SCRATCH_7_REG,
+	.rx_rdptr = PCIE_SCRATCH_8_REG,
+	.rx_wrptr = PCIE_SCRATCH_9_REG,
+	.evt_rdptr = PCIE_SCRATCH_10_REG,
+	.evt_wrptr = PCIE_SCRATCH_11_REG,
+	.drv_rdy = PCIE_SCRATCH_12_REG,
+	.tx_start_ptr = 0,
+	.tx_mask = MWIFIEX_TXBD_MASK,
+	.tx_wrap_mask = 0,
+	.rx_mask = MWIFIEX_RXBD_MASK,
+	.rx_wrap_mask = 0,
+	.tx_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND,
+	.rx_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND,
+	.evt_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND,
+	.ring_flag_sop = 0,
+	.ring_flag_eop = 0,
+	.ring_flag_xs_sop = 0,
+	.ring_flag_xs_eop = 0,
+	.ring_tx_start_ptr = 0,
+	.pfu_enabled = 0,
+	.sleep_cookie = 1,
+	.msix_support = 0,
+};
+
+static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = {
+	.cmd_addr_lo = PCIE_SCRATCH_0_REG,
+	.cmd_addr_hi = PCIE_SCRATCH_1_REG,
+	.cmd_size = PCIE_SCRATCH_2_REG,
+	.fw_status = PCIE_SCRATCH_3_REG,
+	.cmdrsp_addr_lo = PCIE_SCRATCH_4_REG,
+	.cmdrsp_addr_hi = PCIE_SCRATCH_5_REG,
+	.tx_rdptr = PCIE_RD_DATA_PTR_Q0_Q1,
+	.tx_wrptr = PCIE_WR_DATA_PTR_Q0_Q1,
+	.rx_rdptr = PCIE_WR_DATA_PTR_Q0_Q1,
+	.rx_wrptr = PCIE_RD_DATA_PTR_Q0_Q1,
+	.evt_rdptr = PCIE_SCRATCH_10_REG,
+	.evt_wrptr = PCIE_SCRATCH_11_REG,
+	.drv_rdy = PCIE_SCRATCH_12_REG,
+	.tx_start_ptr = 16,
+	.tx_mask = 0x03FF0000,
+	.tx_wrap_mask = 0x07FF0000,
+	.rx_mask = 0x000003FF,
+	.rx_wrap_mask = 0x000007FF,
+	.tx_rollover_ind = MWIFIEX_BD_FLAG_TX_ROLLOVER_IND,
+	.rx_rollover_ind = MWIFIEX_BD_FLAG_RX_ROLLOVER_IND,
+	.evt_rollover_ind = MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND,
+	.ring_flag_sop = MWIFIEX_BD_FLAG_SOP,
+	.ring_flag_eop = MWIFIEX_BD_FLAG_EOP,
+	.ring_flag_xs_sop = MWIFIEX_BD_FLAG_XS_SOP,
+	.ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP,
+	.ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR,
+	.pfu_enabled = 1,
+	.sleep_cookie = 0,
+	.fw_dump_ctrl = PCIE_SCRATCH_13_REG,
+	.fw_dump_start = PCIE_SCRATCH_14_REG,
+	.fw_dump_end = 0xcff,
+	.fw_dump_host_ready = 0xee,
+	.fw_dump_read_done = 0xfe,
+	.msix_support = 0,
+};
+
+static const struct mwifiex_pcie_card_reg mwifiex_reg_8997 = {
+	.cmd_addr_lo = PCIE_SCRATCH_0_REG,
+	.cmd_addr_hi = PCIE_SCRATCH_1_REG,
+	.cmd_size = PCIE_SCRATCH_2_REG,
+	.fw_status = PCIE_SCRATCH_3_REG,
+	.cmdrsp_addr_lo = PCIE_SCRATCH_4_REG,
+	.cmdrsp_addr_hi = PCIE_SCRATCH_5_REG,
+	.tx_rdptr = 0xC1A4,
+	.tx_wrptr = 0xC174,
+	.rx_rdptr = 0xC174,
+	.rx_wrptr = 0xC1A4,
+	.evt_rdptr = PCIE_SCRATCH_10_REG,
+	.evt_wrptr = PCIE_SCRATCH_11_REG,
+	.drv_rdy = PCIE_SCRATCH_12_REG,
+	.tx_start_ptr = 16,
+	.tx_mask = 0x0FFF0000,
+	.tx_wrap_mask = 0x1FFF0000,
+	.rx_mask = 0x00000FFF,
+	.rx_wrap_mask = 0x00001FFF,
+	.tx_rollover_ind = BIT(28),
+	.rx_rollover_ind = BIT(12),
+	.evt_rollover_ind = MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND,
+	.ring_flag_sop = MWIFIEX_BD_FLAG_SOP,
+	.ring_flag_eop = MWIFIEX_BD_FLAG_EOP,
+	.ring_flag_xs_sop = MWIFIEX_BD_FLAG_XS_SOP,
+	.ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP,
+	.ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR,
+	.pfu_enabled = 1,
+	.sleep_cookie = 0,
+	.fw_dump_ctrl = PCIE_SCRATCH_13_REG,
+	.fw_dump_start = PCIE_SCRATCH_14_REG,
+	.fw_dump_end = 0xcff,
+	.fw_dump_host_ready = 0xcc,
+	.fw_dump_read_done = 0xdd,
+	.msix_support = 0,
+};
+
+static struct memory_type_mapping mem_type_mapping_tbl_w8897[] = {
+	{"ITCM", NULL, 0, 0xF0},
+	{"DTCM", NULL, 0, 0xF1},
+	{"SQRAM", NULL, 0, 0xF2},
+	{"IRAM", NULL, 0, 0xF3},
+	{"APU", NULL, 0, 0xF4},
+	{"CIU", NULL, 0, 0xF5},
+	{"ICU", NULL, 0, 0xF6},
+	{"MAC", NULL, 0, 0xF7},
+};
+
+static struct memory_type_mapping mem_type_mapping_tbl_w8997[] = {
+	{"DUMP", NULL, 0, 0xDD},
+};
+
+static const struct mwifiex_pcie_device mwifiex_pcie8766 = {
+	.reg            = &mwifiex_reg_8766,
+	.blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
+	.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
+	.can_dump_fw = false,
+	.can_ext_scan = true,
+};
+
+static const struct mwifiex_pcie_device mwifiex_pcie8897 = {
+	.reg            = &mwifiex_reg_8897,
+	.blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
+	.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
+	.can_dump_fw = true,
+	.mem_type_mapping_tbl = mem_type_mapping_tbl_w8897,
+	.num_mem_types = ARRAY_SIZE(mem_type_mapping_tbl_w8897),
+	.can_ext_scan = true,
+};
+
+static const struct mwifiex_pcie_device mwifiex_pcie8997 = {
+	.reg            = &mwifiex_reg_8997,
+	.blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
+	.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
+	.can_dump_fw = true,
+	.mem_type_mapping_tbl = mem_type_mapping_tbl_w8997,
+	.num_mem_types = ARRAY_SIZE(mem_type_mapping_tbl_w8997),
+	.can_ext_scan = true,
+};
+
 static int mwifiex_pcie_probe_of(struct device *dev)
 {
 	if (!of_match_node(mwifiex_pcie_of_match_table, dev->of_node)) {
drivers/net/wireless/marvell/mwifiex/pcie.h +0 -149

161 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw
Quoted 15 lines · YueHaibing

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 = {
                                         ^~~~~~~~~~~~~~~~
Quoted 1 line

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.

Signature · 3 lines
https://patchwork.kernel.org/patch/11750661/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

A message that is not in the archive (sent off-list or not yet received): 0101017467b37012-2cad5962-8995-49d0-bf12-37c96107742a-000000@us-west-2.amazonses.com

author
#3 lore raw

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

do the same things.

Quoted 78 lines · Kalle Valo
Quoted 15 lines · YueHaibing

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 = {
                                         ^~~~~~~~~~~~~~~~
Quoted 1 line

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.