git: 134b09369960 - main - qlnxe: Remove -Wno-case-qual from module build

From: Warner Losh <imp_at_FreeBSD.org>
Date: Sat, 01 Jul 2023 17:10:12 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=134b09369960a84cf698a639f7f20be3e10966b6

commit 134b09369960a84cf698a639f7f20be3e10966b6
Author:     Mark O'Donovan <shiftee@posteo.net>
AuthorDate: 2023-07-01 17:06:50 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-07-01 17:06:55 +0000

    qlnxe: Remove -Wno-case-qual from module build
    
    Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/779
---
 sys/dev/qlnx/qlnxe/ecore.h              |  2 +-
 sys/dev/qlnx/qlnxe/ecore_dbg_fw_funcs.c | 25 ++++++++++++++-----------
 sys/dev/qlnx/qlnxe/ecore_init_ops.c     | 26 +++++++++++++-------------
 sys/modules/qlnx/qlnxe/Makefile         |  1 -
 4 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/sys/dev/qlnx/qlnxe/ecore.h b/sys/dev/qlnx/qlnxe/ecore.h
index 32a6b98156c5..b83e777dac8e 100644
--- a/sys/dev/qlnx/qlnxe/ecore.h
+++ b/sys/dev/qlnx/qlnxe/ecore.h
@@ -586,7 +586,7 @@ struct ecore_fw_data {
 	struct fw_ver_info *fw_ver_info;
 #endif
 	const u8 *modes_tree_buf;
-	union init_op *init_ops;
+	const union init_op *init_ops;
 	const u32 *arr_data;
 	u32 init_ops_size;
 };
diff --git a/sys/dev/qlnx/qlnxe/ecore_dbg_fw_funcs.c b/sys/dev/qlnx/qlnxe/ecore_dbg_fw_funcs.c
index 5a859982b5f0..4666963cd087 100644
--- a/sys/dev/qlnx/qlnxe/ecore_dbg_fw_funcs.c
+++ b/sys/dev/qlnx/qlnxe/ecore_dbg_fw_funcs.c
@@ -1916,21 +1916,22 @@ static enum dbg_status ecore_dbg_dev_init(struct ecore_hwfn *p_hwfn,
 	return DBG_STATUS_OK;
 }
 
-static struct dbg_bus_block* get_dbg_bus_block_desc(struct ecore_hwfn *p_hwfn,
+static const struct dbg_bus_block *get_dbg_bus_block_desc(struct ecore_hwfn *p_hwfn,
 														  enum block_id block_id)
 {
 	struct dbg_tools_data *dev_data = &p_hwfn->dbg_info;
 
-	return (struct dbg_bus_block *)&dbg_bus_blocks[block_id * MAX_CHIP_IDS + dev_data->chip_id];
+	return (const struct dbg_bus_block *)&dbg_bus_blocks[block_id * MAX_CHIP_IDS + dev_data->chip_id];
 }
 
 /* Returns OSAL_NULL for signature line, latency line and non-existing lines */
-static struct dbg_bus_line* get_dbg_bus_line_desc(struct ecore_hwfn *p_hwfn,
+static const struct dbg_bus_line *get_dbg_bus_line_desc(struct ecore_hwfn *p_hwfn,
 														enum block_id block_id)
 {
 	struct dbg_tools_data *dev_data = &p_hwfn->dbg_info;
 	struct dbg_bus_block_data *block_bus;
-	struct dbg_bus_block *block_desc;
+	const struct dbg_bus_block *block_desc;
+	u32 index;
 
 	block_bus = &dev_data->bus.blocks[block_id];
 	block_desc = get_dbg_bus_block_desc(p_hwfn, block_id);
@@ -1940,7 +1941,9 @@ static struct dbg_bus_line* get_dbg_bus_line_desc(struct ecore_hwfn *p_hwfn,
 		block_bus->line_num >= NUM_DBG_LINES(block_desc))
 		return OSAL_NULL;
 
-	return (struct dbg_bus_line *)&dbg_bus_lines[block_desc->lines_offset + block_bus->line_num - NUM_EXTRA_DBG_LINES(block_desc)];
+	index = block_desc->lines_offset + block_bus->line_num - NUM_EXTRA_DBG_LINES(block_desc);
+
+	return (const struct dbg_bus_line *)&dbg_bus_lines[index];
 }
 
 /* Reads the FW info structure for the specified Storm from the chip,
@@ -2729,7 +2732,7 @@ static bool ecore_is_mode_match(struct ecore_hwfn *p_hwfn,
 	u8 tree_val;
 
 	/* Get next element from modes tree buffer */
-	tree_val = ((u8 *)s_dbg_arrays[BIN_BUF_DBG_MODE_TREE].ptr)[(*modes_buf_offset)++];
+	tree_val = ((const u8 *)s_dbg_arrays[BIN_BUF_DBG_MODE_TREE].ptr)[(*modes_buf_offset)++];
 
 	switch (tree_val) {
 	case INIT_MODE_OP_NOT:
@@ -3989,7 +3992,7 @@ static u32 ecore_grc_dump_static_debug(struct ecore_hwfn *p_hwfn,
 	/* Dump all static debug lines for each relevant block */
 	for (block_id = 0; block_id < MAX_BLOCK_ID; block_id++) {
 		struct block_defs *block = s_block_defs[block_id];
-		struct dbg_bus_block *block_desc;
+		const struct dbg_bus_block *block_desc;
 		u32 block_dwords;
 
 		if (block->dbg_client_id[dev_data->chip_id] == MAX_DBG_BUS_CLIENTS)
@@ -4893,12 +4896,12 @@ static u32 ecore_fw_asserts_dump(struct ecore_hwfn *p_hwfn,
 
 enum dbg_status ecore_dbg_set_bin_ptr(const u8 * const bin_ptr)
 {
-	struct bin_buffer_hdr *buf_array = (struct bin_buffer_hdr *)bin_ptr;
+	const struct bin_buffer_hdr *buf_array = (const struct bin_buffer_hdr *)bin_ptr;
 	u8 buf_id;
 
 	/* convert binary data to debug arrays */
 	for (buf_id = 0; buf_id < MAX_BIN_DBG_BUFFER_TYPE; buf_id++) {
-		s_dbg_arrays[buf_id].ptr = (u32 *)(bin_ptr + buf_array[buf_id].offset);
+		s_dbg_arrays[buf_id].ptr = (const u32 *)(bin_ptr + buf_array[buf_id].offset);
 		s_dbg_arrays[buf_id].size_in_dwords = BYTES_TO_DWORDS(buf_array[buf_id].length);
 	}
 
@@ -5113,7 +5116,7 @@ enum dbg_status ecore_dbg_bus_enable_block(struct ecore_hwfn *p_hwfn,
 	struct dbg_tools_data *dev_data = &p_hwfn->dbg_info;
 	struct block_defs *block = s_block_defs[block_id];
 	struct dbg_bus_block_data *block_bus;
-	struct dbg_bus_block *block_desc;
+	const struct dbg_bus_block *block_desc;
 
 	block_bus = &dev_data->bus.blocks[block_id];
 	block_desc = get_dbg_bus_block_desc(p_hwfn, block_id);
@@ -5574,7 +5577,7 @@ static enum dbg_status ecore_config_dbg_block_framing_mode(struct ecore_hwfn *p_
 	u32 block_id;
 
 	if (!bus->hw_dwords && bus->num_enabled_blocks) {
-		struct dbg_bus_line *line_desc;
+		const struct dbg_bus_line *line_desc;
 		u8 hw_dwords;
 
 		/* Choose either 4 HW dwords (128-bit mode) or 8 HW dwords
diff --git a/sys/dev/qlnx/qlnxe/ecore_init_ops.c b/sys/dev/qlnx/qlnxe/ecore_init_ops.c
index 94c6b2964092..bb3929a3e127 100644
--- a/sys/dev/qlnx/qlnxe/ecore_init_ops.c
+++ b/sys/dev/qlnx/qlnxe/ecore_init_ops.c
@@ -242,7 +242,7 @@ static void ecore_init_fill(struct ecore_hwfn *p_hwfn,
 
 static enum _ecore_status_t ecore_init_cmd_array(struct ecore_hwfn *p_hwfn,
 						 struct ecore_ptt *p_ptt,
-						 struct init_write_op *cmd,
+						 const struct init_write_op *cmd,
 						 bool b_must_dmae,
 						 bool b_can_dmae)
 {
@@ -253,14 +253,14 @@ static enum _ecore_status_t ecore_init_cmd_array(struct ecore_hwfn *p_hwfn,
 	u32 offset, output_len, input_len, max_size;
 #endif
 	struct ecore_dev *p_dev = p_hwfn->p_dev;
-	union init_array_hdr *hdr;
+	const union init_array_hdr *hdr;
 	const u32 *array_data;
 	enum _ecore_status_t rc = ECORE_SUCCESS;
 	u32 size;
 
 	array_data = p_dev->fw_data->arr_data;
 
-	hdr = (union init_array_hdr *) (array_data +
+	hdr = (const union init_array_hdr *) (array_data +
 					dmae_array_offset);
 	data = OSAL_LE32_TO_CPU(hdr->raw.data);
 	switch (GET_FIELD(data, INIT_ARRAY_RAW_HDR_TYPE)) {
@@ -326,7 +326,7 @@ static enum _ecore_status_t ecore_init_cmd_array(struct ecore_hwfn *p_hwfn,
 /* init_ops write command */
 static enum _ecore_status_t ecore_init_cmd_wr(struct ecore_hwfn *p_hwfn,
 					      struct ecore_ptt *p_ptt,
-					      struct init_write_op *p_cmd,
+					      const struct init_write_op *p_cmd,
 					      bool b_can_dmae)
 {
 	u32 data = OSAL_LE32_TO_CPU(p_cmd->data);
@@ -387,7 +387,7 @@ static OSAL_INLINE bool comp_or(u32 val, u32 expected_val)
 /* init_ops read/poll commands */
 static void ecore_init_cmd_rd(struct ecore_hwfn *p_hwfn,
 			      struct ecore_ptt *p_ptt,
-			      struct init_read_op *cmd)
+			      const struct init_read_op *cmd)
 {
 	bool (*comp_check)(u32 val, u32 expected_val);
 	u32 delay = ECORE_INIT_POLL_PERIOD_US, val;
@@ -442,7 +442,7 @@ static void ecore_init_cmd_rd(struct ecore_hwfn *p_hwfn,
 /* init_ops callbacks entry point */
 static enum _ecore_status_t ecore_init_cmd_cb(struct ecore_hwfn *p_hwfn,
 					      struct ecore_ptt *p_ptt,
-					      struct init_callback_op *p_cmd)
+					      const struct init_callback_op *p_cmd)
 {
 	enum _ecore_status_t rc;
 
@@ -486,7 +486,7 @@ static u8 ecore_init_cmd_mode_match(struct ecore_hwfn *p_hwfn,
 }
 
 static u32 ecore_init_cmd_mode(struct ecore_hwfn *p_hwfn,
-			       struct init_if_mode_op *p_cmd, int modes)
+			       const struct init_if_mode_op *p_cmd, int modes)
 {
 	u16 offset = OSAL_LE16_TO_CPU(p_cmd->modes_buf_offset);
 
@@ -497,7 +497,7 @@ static u32 ecore_init_cmd_mode(struct ecore_hwfn *p_hwfn,
 				 INIT_IF_MODE_OP_CMD_OFFSET);
 }
 
-static u32 ecore_init_cmd_phase(struct init_if_phase_op *p_cmd,
+static u32 ecore_init_cmd_phase(const struct init_if_phase_op *p_cmd,
 				u32 phase, u32 phase_id)
 {
 	u32 data = OSAL_LE32_TO_CPU(p_cmd->phase_data);
@@ -519,7 +519,7 @@ enum _ecore_status_t ecore_init_run(struct ecore_hwfn *p_hwfn,
 {
 	struct ecore_dev *p_dev = p_hwfn->p_dev;
 	u32 cmd_num, num_init_ops;
-	union init_op *init_ops;
+	const union init_op *init_ops;
 	bool b_dmae = false;
 	enum _ecore_status_t rc = ECORE_SUCCESS;
 
@@ -536,7 +536,7 @@ enum _ecore_status_t ecore_init_run(struct ecore_hwfn *p_hwfn,
 #endif
 
 	for (cmd_num = 0; cmd_num < num_init_ops; cmd_num++) {
-		union init_op *cmd = &init_ops[cmd_num];
+		const union init_op *cmd = &init_ops[cmd_num];
 		u32 data = OSAL_LE32_TO_CPU(cmd->raw.op_data);
 
 		switch (GET_FIELD(data, INIT_CALLBACK_OP_OP)) {
@@ -661,9 +661,9 @@ enum _ecore_status_t ecore_init_fw_data(struct ecore_dev *p_dev,
 	len = buf_hdr[BIN_BUF_INIT_CMD].length;
 	fw->init_ops_size = len / sizeof(struct init_raw_op);
 #else
-	fw->init_ops = (union init_op *)init_ops;
-	fw->arr_data = (u32 *)init_val;
-	fw->modes_tree_buf = (u8 *)modes_tree_buf;
+	fw->init_ops = (const union init_op *)init_ops;
+	fw->arr_data = (const u32 *)init_val;
+	fw->modes_tree_buf = (const u8 *)modes_tree_buf;
 	fw->init_ops_size = init_ops_size;
 #endif
 
diff --git a/sys/modules/qlnx/qlnxe/Makefile b/sys/modules/qlnx/qlnxe/Makefile
index b033e4a623b5..c0971e443ffd 100644
--- a/sys/modules/qlnx/qlnxe/Makefile
+++ b/sys/modules/qlnx/qlnxe/Makefile
@@ -90,5 +90,4 @@ CFLAGS += -DCONFIG_ECORE_IWARP
 CFLAGS += -DCONFIG_ECORE_RDMA
 CFLAGS += -DQLNX_ENABLE_IWARP
 
-CWARNFLAGS+= -Wno-cast-qual
 CWARNFLAGS.ecore_ll2.c+= ${NO_WUNUSED_BUT_SET_VARIABLE}