Commit 73c289ba authored by Bjoern A. Zeeb's avatar Bjoern A. Zeeb Committed by Luca Coelho

iwlwifi: propagate (const) type qualifier

Most of this change is a continuation of commit 403ea939
("iwlwifi: dbg: Mark ucode tlv data as const") propagating the
(const) type qualifier for ucode based tlv data to avoid having
the impression that it is writeable.
The other part of the change preserves the (const) type qualifier
over casts and function calls where it was previously lost.
Both changes are needed to avoid compile time errors on system with
more strict error settings, in this case found with clang on FreeBSD.

Sponsored by:  The FreeBSD Foundation
Signed-off-by: default avatarBjoern A. Zeeb <bz@FreeBSD.ORG>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
[fix double word in commit message]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220128153014.3230c41312fc.I0032c597984834258d5a79b97052ed83dbe53b80@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 0301bcd5
...@@ -33,7 +33,7 @@ static bool iwl_pnvm_complete_fn(struct iwl_notif_wait_data *notif_wait, ...@@ -33,7 +33,7 @@ static bool iwl_pnvm_complete_fn(struct iwl_notif_wait_data *notif_wait,
static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data, static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
size_t len) size_t len)
{ {
struct iwl_ucode_tlv *tlv; const struct iwl_ucode_tlv *tlv;
u32 sha1 = 0; u32 sha1 = 0;
u16 mac_type = 0, rf_id = 0; u16 mac_type = 0, rf_id = 0;
u8 *pnvm_data = NULL, *tmp; u8 *pnvm_data = NULL, *tmp;
...@@ -47,7 +47,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data, ...@@ -47,7 +47,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
u32 tlv_len, tlv_type; u32 tlv_len, tlv_type;
len -= sizeof(*tlv); len -= sizeof(*tlv);
tlv = (void *)data; tlv = (const void *)data;
tlv_len = le32_to_cpu(tlv->length); tlv_len = le32_to_cpu(tlv->length);
tlv_type = le32_to_cpu(tlv->type); tlv_type = le32_to_cpu(tlv->type);
...@@ -70,7 +70,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data, ...@@ -70,7 +70,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
break; break;
} }
sha1 = le32_to_cpup((__le32 *)data); sha1 = le32_to_cpup((const __le32 *)data);
IWL_DEBUG_FW(trans, IWL_DEBUG_FW(trans,
"Got IWL_UCODE_TLV_PNVM_VERSION %0x\n", "Got IWL_UCODE_TLV_PNVM_VERSION %0x\n",
...@@ -87,8 +87,8 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data, ...@@ -87,8 +87,8 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
if (hw_match) if (hw_match)
break; break;
mac_type = le16_to_cpup((__le16 *)data); mac_type = le16_to_cpup((const __le16 *)data);
rf_id = le16_to_cpup((__le16 *)(data + sizeof(__le16))); rf_id = le16_to_cpup((const __le16 *)(data + sizeof(__le16)));
IWL_DEBUG_FW(trans, IWL_DEBUG_FW(trans,
"Got IWL_UCODE_TLV_HW_TYPE mac_type 0x%0x rf_id 0x%0x\n", "Got IWL_UCODE_TLV_HW_TYPE mac_type 0x%0x rf_id 0x%0x\n",
...@@ -99,7 +99,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data, ...@@ -99,7 +99,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
hw_match = true; hw_match = true;
break; break;
case IWL_UCODE_TLV_SEC_RT: { case IWL_UCODE_TLV_SEC_RT: {
struct iwl_pnvm_section *section = (void *)data; const struct iwl_pnvm_section *section = (const void *)data;
u32 data_len = tlv_len - sizeof(*section); u32 data_len = tlv_len - sizeof(*section);
IWL_DEBUG_FW(trans, IWL_DEBUG_FW(trans,
...@@ -107,7 +107,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data, ...@@ -107,7 +107,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
tlv_len); tlv_len);
/* TODO: remove, this is a deprecated separator */ /* TODO: remove, this is a deprecated separator */
if (le32_to_cpup((__le32 *)data) == 0xddddeeee) { if (le32_to_cpup((const __le32 *)data) == 0xddddeeee) {
IWL_DEBUG_FW(trans, "Ignoring separator.\n"); IWL_DEBUG_FW(trans, "Ignoring separator.\n");
break; break;
} }
...@@ -173,7 +173,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data, ...@@ -173,7 +173,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data, static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data,
size_t len) size_t len)
{ {
struct iwl_ucode_tlv *tlv; const struct iwl_ucode_tlv *tlv;
IWL_DEBUG_FW(trans, "Parsing PNVM file\n"); IWL_DEBUG_FW(trans, "Parsing PNVM file\n");
...@@ -193,8 +193,8 @@ static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data, ...@@ -193,8 +193,8 @@ static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data,
} }
if (tlv_type == IWL_UCODE_TLV_PNVM_SKU) { if (tlv_type == IWL_UCODE_TLV_PNVM_SKU) {
struct iwl_sku_id *sku_id = const struct iwl_sku_id *sku_id =
(void *)(data + sizeof(*tlv)); (const void *)(data + sizeof(*tlv));
IWL_DEBUG_FW(trans, IWL_DEBUG_FW(trans,
"Got IWL_UCODE_TLV_PNVM_SKU len %d\n", "Got IWL_UCODE_TLV_PNVM_SKU len %d\n",
......
...@@ -460,7 +460,7 @@ static int iwl_dbg_tlv_parse_bin(struct iwl_trans *trans, const u8 *data, ...@@ -460,7 +460,7 @@ static int iwl_dbg_tlv_parse_bin(struct iwl_trans *trans, const u8 *data,
while (len >= sizeof(*tlv)) { while (len >= sizeof(*tlv)) {
len -= sizeof(*tlv); len -= sizeof(*tlv);
tlv = (void *)data; tlv = (const void *)data;
tlv_len = le32_to_cpu(tlv->length); tlv_len = le32_to_cpu(tlv->length);
......
...@@ -243,14 +243,14 @@ struct iwl_firmware_pieces { ...@@ -243,14 +243,14 @@ struct iwl_firmware_pieces {
/* FW debug data parsed for driver usage */ /* FW debug data parsed for driver usage */
bool dbg_dest_tlv_init; bool dbg_dest_tlv_init;
u8 *dbg_dest_ver; const u8 *dbg_dest_ver;
union { union {
struct iwl_fw_dbg_dest_tlv *dbg_dest_tlv; const struct iwl_fw_dbg_dest_tlv *dbg_dest_tlv;
struct iwl_fw_dbg_dest_tlv_v1 *dbg_dest_tlv_v1; const struct iwl_fw_dbg_dest_tlv_v1 *dbg_dest_tlv_v1;
}; };
struct iwl_fw_dbg_conf_tlv *dbg_conf_tlv[FW_DBG_CONF_MAX]; const struct iwl_fw_dbg_conf_tlv *dbg_conf_tlv[FW_DBG_CONF_MAX];
size_t dbg_conf_tlv_len[FW_DBG_CONF_MAX]; size_t dbg_conf_tlv_len[FW_DBG_CONF_MAX];
struct iwl_fw_dbg_trigger_tlv *dbg_trigger_tlv[FW_DBG_TRIGGER_MAX]; const struct iwl_fw_dbg_trigger_tlv *dbg_trigger_tlv[FW_DBG_TRIGGER_MAX];
size_t dbg_trigger_tlv_len[FW_DBG_TRIGGER_MAX]; size_t dbg_trigger_tlv_len[FW_DBG_TRIGGER_MAX];
struct iwl_fw_dbg_mem_seg_tlv *dbg_mem_tlv; struct iwl_fw_dbg_mem_seg_tlv *dbg_mem_tlv;
size_t n_mem_tlv; size_t n_mem_tlv;
...@@ -327,8 +327,9 @@ static void set_sec_offset(struct iwl_firmware_pieces *pieces, ...@@ -327,8 +327,9 @@ static void set_sec_offset(struct iwl_firmware_pieces *pieces,
static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len) static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len)
{ {
int i, j; int i, j;
struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data; const struct iwl_fw_cscheme_list *l =
struct iwl_fw_cipher_scheme *fwcs; (const struct iwl_fw_cscheme_list *)data;
const struct iwl_fw_cipher_scheme *fwcs;
if (len < sizeof(*l) || if (len < sizeof(*l) ||
len < sizeof(l->size) + l->size * sizeof(l->cs[0])) len < sizeof(l->size) + l->size * sizeof(l->cs[0]))
...@@ -356,13 +357,13 @@ static int iwl_store_ucode_sec(struct iwl_firmware_pieces *pieces, ...@@ -356,13 +357,13 @@ static int iwl_store_ucode_sec(struct iwl_firmware_pieces *pieces,
{ {
struct fw_img_parsing *img; struct fw_img_parsing *img;
struct fw_sec *sec; struct fw_sec *sec;
struct fw_sec_parsing *sec_parse; const struct fw_sec_parsing *sec_parse;
size_t alloc_size; size_t alloc_size;
if (WARN_ON(!pieces || !data || type >= IWL_UCODE_TYPE_MAX)) if (WARN_ON(!pieces || !data || type >= IWL_UCODE_TYPE_MAX))
return -1; return -1;
sec_parse = (struct fw_sec_parsing *)data; sec_parse = (const struct fw_sec_parsing *)data;
img = &pieces->img[type]; img = &pieces->img[type];
...@@ -385,8 +386,8 @@ static int iwl_store_ucode_sec(struct iwl_firmware_pieces *pieces, ...@@ -385,8 +386,8 @@ static int iwl_store_ucode_sec(struct iwl_firmware_pieces *pieces,
static int iwl_set_default_calib(struct iwl_drv *drv, const u8 *data) static int iwl_set_default_calib(struct iwl_drv *drv, const u8 *data)
{ {
struct iwl_tlv_calib_data *def_calib = const struct iwl_tlv_calib_data *def_calib =
(struct iwl_tlv_calib_data *)data; (const struct iwl_tlv_calib_data *)data;
u32 ucode_type = le32_to_cpu(def_calib->ucode_type); u32 ucode_type = le32_to_cpu(def_calib->ucode_type);
if (ucode_type >= IWL_UCODE_TYPE_MAX) { if (ucode_type >= IWL_UCODE_TYPE_MAX) {
IWL_ERR(drv, "Wrong ucode_type %u for default calibration.\n", IWL_ERR(drv, "Wrong ucode_type %u for default calibration.\n",
...@@ -404,7 +405,7 @@ static int iwl_set_default_calib(struct iwl_drv *drv, const u8 *data) ...@@ -404,7 +405,7 @@ static int iwl_set_default_calib(struct iwl_drv *drv, const u8 *data)
static void iwl_set_ucode_api_flags(struct iwl_drv *drv, const u8 *data, static void iwl_set_ucode_api_flags(struct iwl_drv *drv, const u8 *data,
struct iwl_ucode_capabilities *capa) struct iwl_ucode_capabilities *capa)
{ {
const struct iwl_ucode_api *ucode_api = (void *)data; const struct iwl_ucode_api *ucode_api = (const void *)data;
u32 api_index = le32_to_cpu(ucode_api->api_index); u32 api_index = le32_to_cpu(ucode_api->api_index);
u32 api_flags = le32_to_cpu(ucode_api->api_flags); u32 api_flags = le32_to_cpu(ucode_api->api_flags);
int i; int i;
...@@ -425,7 +426,7 @@ static void iwl_set_ucode_api_flags(struct iwl_drv *drv, const u8 *data, ...@@ -425,7 +426,7 @@ static void iwl_set_ucode_api_flags(struct iwl_drv *drv, const u8 *data,
static void iwl_set_ucode_capabilities(struct iwl_drv *drv, const u8 *data, static void iwl_set_ucode_capabilities(struct iwl_drv *drv, const u8 *data,
struct iwl_ucode_capabilities *capa) struct iwl_ucode_capabilities *capa)
{ {
const struct iwl_ucode_capa *ucode_capa = (void *)data; const struct iwl_ucode_capa *ucode_capa = (const void *)data;
u32 api_index = le32_to_cpu(ucode_capa->api_index); u32 api_index = le32_to_cpu(ucode_capa->api_index);
u32 api_flags = le32_to_cpu(ucode_capa->api_capa); u32 api_flags = le32_to_cpu(ucode_capa->api_capa);
int i; int i;
...@@ -457,7 +458,7 @@ static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv, ...@@ -457,7 +458,7 @@ static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv,
const struct firmware *ucode_raw, const struct firmware *ucode_raw,
struct iwl_firmware_pieces *pieces) struct iwl_firmware_pieces *pieces)
{ {
struct iwl_ucode_header *ucode = (void *)ucode_raw->data; const struct iwl_ucode_header *ucode = (const void *)ucode_raw->data;
u32 api_ver, hdr_size, build; u32 api_ver, hdr_size, build;
char buildstr[25]; char buildstr[25];
const u8 *src; const u8 *src;
...@@ -655,7 +656,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -655,7 +656,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
struct iwl_ucode_capabilities *capa, struct iwl_ucode_capabilities *capa,
bool *usniffer_images) bool *usniffer_images)
{ {
struct iwl_tlv_ucode_header *ucode = (void *)ucode_raw->data; const struct iwl_tlv_ucode_header *ucode = (const void *)ucode_raw->data;
const struct iwl_ucode_tlv *tlv; const struct iwl_ucode_tlv *tlv;
size_t len = ucode_raw->size; size_t len = ucode_raw->size;
const u8 *data; const u8 *data;
...@@ -704,8 +705,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -704,8 +705,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
while (len >= sizeof(*tlv)) { while (len >= sizeof(*tlv)) {
len -= sizeof(*tlv); len -= sizeof(*tlv);
tlv = (void *)data;
tlv = (const void *)data;
tlv_len = le32_to_cpu(tlv->length); tlv_len = le32_to_cpu(tlv->length);
tlv_type = le32_to_cpu(tlv->type); tlv_type = le32_to_cpu(tlv->type);
tlv_data = tlv->data; tlv_data = tlv->data;
...@@ -762,7 +763,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -762,7 +763,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
capa->max_probe_length = capa->max_probe_length =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_PAN: case IWL_UCODE_TLV_PAN:
if (tlv_len) if (tlv_len)
...@@ -783,7 +784,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -783,7 +784,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
* will not work with the new firmware, or * will not work with the new firmware, or
* it'll not take advantage of new features. * it'll not take advantage of new features.
*/ */
capa->flags = le32_to_cpup((__le32 *)tlv_data); capa->flags = le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_API_CHANGES_SET: case IWL_UCODE_TLV_API_CHANGES_SET:
if (tlv_len != sizeof(struct iwl_ucode_api)) if (tlv_len != sizeof(struct iwl_ucode_api))
...@@ -799,37 +800,37 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -799,37 +800,37 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
pieces->init_evtlog_ptr = pieces->init_evtlog_ptr =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_INIT_EVTLOG_SIZE: case IWL_UCODE_TLV_INIT_EVTLOG_SIZE:
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
pieces->init_evtlog_size = pieces->init_evtlog_size =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_INIT_ERRLOG_PTR: case IWL_UCODE_TLV_INIT_ERRLOG_PTR:
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
pieces->init_errlog_ptr = pieces->init_errlog_ptr =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_RUNT_EVTLOG_PTR: case IWL_UCODE_TLV_RUNT_EVTLOG_PTR:
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
pieces->inst_evtlog_ptr = pieces->inst_evtlog_ptr =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_RUNT_EVTLOG_SIZE: case IWL_UCODE_TLV_RUNT_EVTLOG_SIZE:
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
pieces->inst_evtlog_size = pieces->inst_evtlog_size =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_RUNT_ERRLOG_PTR: case IWL_UCODE_TLV_RUNT_ERRLOG_PTR:
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
pieces->inst_errlog_ptr = pieces->inst_errlog_ptr =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_ENHANCE_SENS_TBL: case IWL_UCODE_TLV_ENHANCE_SENS_TBL:
if (tlv_len) if (tlv_len)
...@@ -858,7 +859,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -858,7 +859,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
capa->standard_phy_calibration_size = capa->standard_phy_calibration_size =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_SEC_RT: case IWL_UCODE_TLV_SEC_RT:
iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR,
...@@ -884,7 +885,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -884,7 +885,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
case IWL_UCODE_TLV_PHY_SKU: case IWL_UCODE_TLV_PHY_SKU:
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
drv->fw.phy_config = le32_to_cpup((__le32 *)tlv_data); drv->fw.phy_config = le32_to_cpup((const __le32 *)tlv_data);
drv->fw.valid_tx_ant = (drv->fw.phy_config & drv->fw.valid_tx_ant = (drv->fw.phy_config &
FW_PHY_CFG_TX_CHAIN) >> FW_PHY_CFG_TX_CHAIN) >>
FW_PHY_CFG_TX_CHAIN_POS; FW_PHY_CFG_TX_CHAIN_POS;
...@@ -911,7 +912,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -911,7 +912,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
num_of_cpus = num_of_cpus =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
if (num_of_cpus == 2) { if (num_of_cpus == 2) {
drv->fw.img[IWL_UCODE_REGULAR].is_dual_cpus = drv->fw.img[IWL_UCODE_REGULAR].is_dual_cpus =
...@@ -933,10 +934,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -933,10 +934,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
capa->n_scan_channels = capa->n_scan_channels =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_FW_VERSION: { case IWL_UCODE_TLV_FW_VERSION: {
__le32 *ptr = (void *)tlv_data; const __le32 *ptr = (const void *)tlv_data;
u32 major, minor; u32 major, minor;
u8 local_comp; u8 local_comp;
...@@ -960,15 +961,15 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -960,15 +961,15 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
break; break;
} }
case IWL_UCODE_TLV_FW_DBG_DEST: { case IWL_UCODE_TLV_FW_DBG_DEST: {
struct iwl_fw_dbg_dest_tlv *dest = NULL; const struct iwl_fw_dbg_dest_tlv *dest = NULL;
struct iwl_fw_dbg_dest_tlv_v1 *dest_v1 = NULL; const struct iwl_fw_dbg_dest_tlv_v1 *dest_v1 = NULL;
u8 mon_mode; u8 mon_mode;
pieces->dbg_dest_ver = (u8 *)tlv_data; pieces->dbg_dest_ver = (const u8 *)tlv_data;
if (*pieces->dbg_dest_ver == 1) { if (*pieces->dbg_dest_ver == 1) {
dest = (void *)tlv_data; dest = (const void *)tlv_data;
} else if (*pieces->dbg_dest_ver == 0) { } else if (*pieces->dbg_dest_ver == 0) {
dest_v1 = (void *)tlv_data; dest_v1 = (const void *)tlv_data;
} else { } else {
IWL_ERR(drv, IWL_ERR(drv,
"The version is %d, and it is invalid\n", "The version is %d, and it is invalid\n",
...@@ -1009,7 +1010,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1009,7 +1010,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
break; break;
} }
case IWL_UCODE_TLV_FW_DBG_CONF: { case IWL_UCODE_TLV_FW_DBG_CONF: {
struct iwl_fw_dbg_conf_tlv *conf = (void *)tlv_data; const struct iwl_fw_dbg_conf_tlv *conf =
(const void *)tlv_data;
if (!pieces->dbg_dest_tlv_init) { if (!pieces->dbg_dest_tlv_init) {
IWL_ERR(drv, IWL_ERR(drv,
...@@ -1043,8 +1045,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1043,8 +1045,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
break; break;
} }
case IWL_UCODE_TLV_FW_DBG_TRIGGER: { case IWL_UCODE_TLV_FW_DBG_TRIGGER: {
struct iwl_fw_dbg_trigger_tlv *trigger = const struct iwl_fw_dbg_trigger_tlv *trigger =
(void *)tlv_data; (const void *)tlv_data;
u32 trigger_id = le32_to_cpu(trigger->id); u32 trigger_id = le32_to_cpu(trigger->id);
if (trigger_id >= ARRAY_SIZE(drv->fw.dbg.trigger_tlv)) { if (trigger_id >= ARRAY_SIZE(drv->fw.dbg.trigger_tlv)) {
...@@ -1075,7 +1077,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1075,7 +1077,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
} }
drv->fw.dbg.dump_mask = drv->fw.dbg.dump_mask =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
} }
case IWL_UCODE_TLV_SEC_RT_USNIFFER: case IWL_UCODE_TLV_SEC_RT_USNIFFER:
...@@ -1087,7 +1089,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1087,7 +1089,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
case IWL_UCODE_TLV_PAGING: case IWL_UCODE_TLV_PAGING:
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
paging_mem_size = le32_to_cpup((__le32 *)tlv_data); paging_mem_size = le32_to_cpup((const __le32 *)tlv_data);
IWL_DEBUG_FW(drv, IWL_DEBUG_FW(drv,
"Paging: paging enabled (size = %u bytes)\n", "Paging: paging enabled (size = %u bytes)\n",
...@@ -1117,8 +1119,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1117,8 +1119,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
/* ignored */ /* ignored */
break; break;
case IWL_UCODE_TLV_FW_MEM_SEG: { case IWL_UCODE_TLV_FW_MEM_SEG: {
struct iwl_fw_dbg_mem_seg_tlv *dbg_mem = const struct iwl_fw_dbg_mem_seg_tlv *dbg_mem =
(void *)tlv_data; (const void *)tlv_data;
size_t size; size_t size;
struct iwl_fw_dbg_mem_seg_tlv *n; struct iwl_fw_dbg_mem_seg_tlv *n;
...@@ -1146,10 +1148,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1146,10 +1148,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
break; break;
} }
case IWL_UCODE_TLV_FW_RECOVERY_INFO: { case IWL_UCODE_TLV_FW_RECOVERY_INFO: {
struct { const struct {
__le32 buf_addr; __le32 buf_addr;
__le32 buf_size; __le32 buf_size;
} *recov_info = (void *)tlv_data; } *recov_info = (const void *)tlv_data;
if (tlv_len != sizeof(*recov_info)) if (tlv_len != sizeof(*recov_info))
goto invalid_tlv_len; goto invalid_tlv_len;
...@@ -1160,10 +1162,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1160,10 +1162,10 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
} }
break; break;
case IWL_UCODE_TLV_FW_FSEQ_VERSION: { case IWL_UCODE_TLV_FW_FSEQ_VERSION: {
struct { const struct {
u8 version[32]; u8 version[32];
u8 sha1[20]; u8 sha1[20];
} *fseq_ver = (void *)tlv_data; } *fseq_ver = (const void *)tlv_data;
if (tlv_len != sizeof(*fseq_ver)) if (tlv_len != sizeof(*fseq_ver))
goto invalid_tlv_len; goto invalid_tlv_len;
...@@ -1174,19 +1176,19 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1174,19 +1176,19 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
case IWL_UCODE_TLV_FW_NUM_STATIONS: case IWL_UCODE_TLV_FW_NUM_STATIONS:
if (tlv_len != sizeof(u32)) if (tlv_len != sizeof(u32))
goto invalid_tlv_len; goto invalid_tlv_len;
if (le32_to_cpup((__le32 *)tlv_data) > if (le32_to_cpup((const __le32 *)tlv_data) >
IWL_MVM_STATION_COUNT_MAX) { IWL_MVM_STATION_COUNT_MAX) {
IWL_ERR(drv, IWL_ERR(drv,
"%d is an invalid number of station\n", "%d is an invalid number of station\n",
le32_to_cpup((__le32 *)tlv_data)); le32_to_cpup((const __le32 *)tlv_data));
goto tlv_error; goto tlv_error;
} }
capa->num_stations = capa->num_stations =
le32_to_cpup((__le32 *)tlv_data); le32_to_cpup((const __le32 *)tlv_data);
break; break;
case IWL_UCODE_TLV_UMAC_DEBUG_ADDRS: { case IWL_UCODE_TLV_UMAC_DEBUG_ADDRS: {
struct iwl_umac_debug_addrs *dbg_ptrs = const struct iwl_umac_debug_addrs *dbg_ptrs =
(void *)tlv_data; (const void *)tlv_data;
if (tlv_len != sizeof(*dbg_ptrs)) if (tlv_len != sizeof(*dbg_ptrs))
goto invalid_tlv_len; goto invalid_tlv_len;
...@@ -1201,8 +1203,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, ...@@ -1201,8 +1203,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
break; break;
} }
case IWL_UCODE_TLV_LMAC_DEBUG_ADDRS: { case IWL_UCODE_TLV_LMAC_DEBUG_ADDRS: {
struct iwl_lmac_debug_addrs *dbg_ptrs = const struct iwl_lmac_debug_addrs *dbg_ptrs =
(void *)tlv_data; (const void *)tlv_data;
if (tlv_len != sizeof(*dbg_ptrs)) if (tlv_len != sizeof(*dbg_ptrs))
goto invalid_tlv_len; goto invalid_tlv_len;
...@@ -1418,7 +1420,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) ...@@ -1418,7 +1420,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
{ {
struct iwl_drv *drv = context; struct iwl_drv *drv = context;
struct iwl_fw *fw = &drv->fw; struct iwl_fw *fw = &drv->fw;
struct iwl_ucode_header *ucode; const struct iwl_ucode_header *ucode;
struct iwlwifi_opmode_table *op; struct iwlwifi_opmode_table *op;
int err; int err;
struct iwl_firmware_pieces *pieces; struct iwl_firmware_pieces *pieces;
...@@ -1456,7 +1458,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) ...@@ -1456,7 +1458,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
} }
/* Data from ucode file: header followed by uCode images */ /* Data from ucode file: header followed by uCode images */
ucode = (struct iwl_ucode_header *)ucode_raw->data; ucode = (const struct iwl_ucode_header *)ucode_raw->data;
if (ucode->ver) if (ucode->ver)
err = iwl_parse_v1_v2_firmware(drv, ucode_raw, pieces); err = iwl_parse_v1_v2_firmware(drv, ucode_raw, pieces);
......
...@@ -375,10 +375,10 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, ...@@ -375,10 +375,10 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
if (v4) if (v4)
ch_flags = ch_flags =
__le32_to_cpup((__le32 *)nvm_ch_flags + ch_idx); __le32_to_cpup((const __le32 *)nvm_ch_flags + ch_idx);
else else
ch_flags = ch_flags =
__le16_to_cpup((__le16 *)nvm_ch_flags + ch_idx); __le16_to_cpup((const __le16 *)nvm_ch_flags + ch_idx);
if (band == NL80211_BAND_5GHZ && if (band == NL80211_BAND_5GHZ &&
!data->sku_cap_band_52ghz_enable) !data->sku_cap_band_52ghz_enable)
...@@ -912,7 +912,7 @@ static int iwl_get_sku(const struct iwl_cfg *cfg, const __le16 *nvm_sw, ...@@ -912,7 +912,7 @@ static int iwl_get_sku(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
if (cfg->nvm_type != IWL_NVM_EXT) if (cfg->nvm_type != IWL_NVM_EXT)
return le16_to_cpup(nvm_sw + SKU); return le16_to_cpup(nvm_sw + SKU);
return le32_to_cpup((__le32 *)(phy_sku + SKU_FAMILY_8000)); return le32_to_cpup((const __le32 *)(phy_sku + SKU_FAMILY_8000));
} }
static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw) static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
...@@ -920,7 +920,7 @@ static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw) ...@@ -920,7 +920,7 @@ static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
if (cfg->nvm_type != IWL_NVM_EXT) if (cfg->nvm_type != IWL_NVM_EXT)
return le16_to_cpup(nvm_sw + NVM_VERSION); return le16_to_cpup(nvm_sw + NVM_VERSION);
else else
return le32_to_cpup((__le32 *)(nvm_sw + return le32_to_cpup((const __le32 *)(nvm_sw +
NVM_VERSION_EXT_NVM)); NVM_VERSION_EXT_NVM));
} }
...@@ -930,7 +930,7 @@ static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw, ...@@ -930,7 +930,7 @@ static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
if (cfg->nvm_type != IWL_NVM_EXT) if (cfg->nvm_type != IWL_NVM_EXT)
return le16_to_cpup(nvm_sw + RADIO_CFG); return le16_to_cpup(nvm_sw + RADIO_CFG);
return le32_to_cpup((__le32 *)(phy_sku + RADIO_CFG_FAMILY_EXT_NVM)); return le32_to_cpup((const __le32 *)(phy_sku + RADIO_CFG_FAMILY_EXT_NVM));
} }
...@@ -941,7 +941,7 @@ static int iwl_get_n_hw_addrs(const struct iwl_cfg *cfg, const __le16 *nvm_sw) ...@@ -941,7 +941,7 @@ static int iwl_get_n_hw_addrs(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
if (cfg->nvm_type != IWL_NVM_EXT) if (cfg->nvm_type != IWL_NVM_EXT)
return le16_to_cpup(nvm_sw + N_HW_ADDRS); return le16_to_cpup(nvm_sw + N_HW_ADDRS);
n_hw_addr = le32_to_cpup((__le32 *)(nvm_sw + N_HW_ADDRS_FAMILY_8000)); n_hw_addr = le32_to_cpup((const __le32 *)(nvm_sw + N_HW_ADDRS_FAMILY_8000));
return n_hw_addr & N_HW_ADDR_MASK; return n_hw_addr & N_HW_ADDR_MASK;
} }
...@@ -1592,7 +1592,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans, ...@@ -1592,7 +1592,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans,
} }
eof = fw_entry->data + fw_entry->size; eof = fw_entry->data + fw_entry->size;
dword_buff = (__le32 *)fw_entry->data; dword_buff = (const __le32 *)fw_entry->data;
/* some NVM file will contain a header. /* some NVM file will contain a header.
* The header is identified by 2 dwords header as follow: * The header is identified by 2 dwords header as follow:
...@@ -1604,7 +1604,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans, ...@@ -1604,7 +1604,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans,
if (fw_entry->size > NVM_HEADER_SIZE && if (fw_entry->size > NVM_HEADER_SIZE &&
dword_buff[0] == cpu_to_le32(NVM_HEADER_0) && dword_buff[0] == cpu_to_le32(NVM_HEADER_0) &&
dword_buff[1] == cpu_to_le32(NVM_HEADER_1)) { dword_buff[1] == cpu_to_le32(NVM_HEADER_1)) {
file_sec = (void *)(fw_entry->data + NVM_HEADER_SIZE); file_sec = (const void *)(fw_entry->data + NVM_HEADER_SIZE);
IWL_INFO(trans, "NVM Version %08X\n", le32_to_cpu(dword_buff[2])); IWL_INFO(trans, "NVM Version %08X\n", le32_to_cpu(dword_buff[2]));
IWL_INFO(trans, "NVM Manufacturing date %08X\n", IWL_INFO(trans, "NVM Manufacturing date %08X\n",
le32_to_cpu(dword_buff[3])); le32_to_cpu(dword_buff[3]));
...@@ -1617,7 +1617,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans, ...@@ -1617,7 +1617,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans,
goto out; goto out;
} }
} else { } else {
file_sec = (void *)fw_entry->data; file_sec = (const void *)fw_entry->data;
} }
while (true) { while (true) {
...@@ -1685,7 +1685,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans, ...@@ -1685,7 +1685,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans,
nvm_sections[section_id].length = section_size; nvm_sections[section_id].length = section_size;
/* advance to the next section */ /* advance to the next section */
file_sec = (void *)(file_sec->data + section_size); file_sec = (const void *)(file_sec->data + section_size);
} }
out: out:
release_firmware(fw_entry); release_firmware(fw_entry);
......
...@@ -203,10 +203,10 @@ IWL_EXPORT_SYMBOL(iwl_trans_send_cmd); ...@@ -203,10 +203,10 @@ IWL_EXPORT_SYMBOL(iwl_trans_send_cmd);
static int iwl_hcmd_names_cmp(const void *key, const void *elt) static int iwl_hcmd_names_cmp(const void *key, const void *elt)
{ {
const struct iwl_hcmd_names *name = elt; const struct iwl_hcmd_names *name = elt;
u8 cmd1 = *(u8 *)key; const u8 *cmd1 = key;
u8 cmd2 = name->cmd_id; u8 cmd2 = name->cmd_id;
return (cmd1 - cmd2); return (*cmd1 - cmd2);
} }
const char *iwl_get_cmd_string(struct iwl_trans *trans, u32 id) const char *iwl_get_cmd_string(struct iwl_trans *trans, u32 id)
......
...@@ -653,7 +653,8 @@ static void iwl_mvm_probe_resp_set_noa(struct iwl_mvm *mvm, ...@@ -653,7 +653,8 @@ static void iwl_mvm_probe_resp_set_noa(struct iwl_mvm *mvm,
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
int base_len = (u8 *)mgmt->u.probe_resp.variable - (u8 *)mgmt; int base_len = (u8 *)mgmt->u.probe_resp.variable - (u8 *)mgmt;
struct iwl_probe_resp_data *resp_data; struct iwl_probe_resp_data *resp_data;
u8 *ie, *pos; const u8 *ie;
u8 *pos;
u8 match[] = { u8 match[] = {
(WLAN_OUI_WFA >> 16) & 0xff, (WLAN_OUI_WFA >> 16) & 0xff,
(WLAN_OUI_WFA >> 8) & 0xff, (WLAN_OUI_WFA >> 8) & 0xff,
...@@ -670,7 +671,7 @@ static void iwl_mvm_probe_resp_set_noa(struct iwl_mvm *mvm, ...@@ -670,7 +671,7 @@ static void iwl_mvm_probe_resp_set_noa(struct iwl_mvm *mvm,
if (!resp_data->notif.noa_active) if (!resp_data->notif.noa_active)
goto out; goto out;
ie = (u8 *)cfg80211_find_ie_match(WLAN_EID_VENDOR_SPECIFIC, ie = cfg80211_find_ie_match(WLAN_EID_VENDOR_SPECIFIC,
mgmt->u.probe_resp.variable, mgmt->u.probe_resp.variable,
skb->len - base_len, skb->len - base_len,
match, 4, 2); match, 4, 2);
......
...@@ -745,7 +745,7 @@ static int iwl_pcie_load_section(struct iwl_trans *trans, u8 section_num, ...@@ -745,7 +745,7 @@ static int iwl_pcie_load_section(struct iwl_trans *trans, u8 section_num,
iwl_set_bits_prph(trans, LMPM_CHICK, iwl_set_bits_prph(trans, LMPM_CHICK,
LMPM_CHICK_EXTENDED_ADDR_SPACE); LMPM_CHICK_EXTENDED_ADDR_SPACE);
memcpy(v_addr, (u8 *)section->data + offset, copy_size); memcpy(v_addr, (const u8 *)section->data + offset, copy_size);
ret = iwl_pcie_load_firmware_chunk(trans, dst_addr, p_addr, ret = iwl_pcie_load_firmware_chunk(trans, dst_addr, p_addr,
copy_size); copy_size);
......
...@@ -877,7 +877,7 @@ void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id, ...@@ -877,7 +877,7 @@ void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id,
if (configure_scd) { if (configure_scd) {
iwl_scd_txq_set_inactive(trans, txq_id); iwl_scd_txq_set_inactive(trans, txq_id);
iwl_trans_write_mem(trans, stts_addr, (void *)zero_val, iwl_trans_write_mem(trans, stts_addr, (const void *)zero_val,
ARRAY_SIZE(zero_val)); ARRAY_SIZE(zero_val));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment