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);
......
...@@ -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,8 +920,8 @@ static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw) ...@@ -920,8 +920,8 @@ 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));
} }
static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw, 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, ...@@ -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,10 +671,10 @@ static void iwl_mvm_probe_resp_set_noa(struct iwl_mvm *mvm, ...@@ -670,10 +671,10 @@ 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);
if (!ie) { if (!ie) {
IWL_DEBUG_TX(mvm, "probe resp doesn't have P2P IE\n"); IWL_DEBUG_TX(mvm, "probe resp doesn't have P2P IE\n");
goto out; goto out;
......
...@@ -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