iwlwifi: de-const properly where needed
authorBjoern A. Zeeb <bz@FreeBSD.ORG>
Fri, 28 Jan 2022 13:34:26 +0000 (15:34 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 18 Feb 2022 08:40:50 +0000 (10:40 +0200)
In order to de-const variables simply casting through (void *) is
not enough: "cast from 'const .. *' to 'void *' drops const qualifier".
Cast through (uintptr_t) as well [1] to make this compile on systems
with more strict requirements.
In addition passing const void *data to dma_map_single() also
drops the (const) qualifier.  De-constify on variable on assignment
which may be overwritten later.  In either case the (void *) cast
to dma_map_single() is not needed (anymore) either.

[1] See __DECONST() in sys/sys/cdefs.h in FreeBSD

Sponsored by:  The FreeBSD Foundation
Signed-off-by: Bjoern A. Zeeb <bz@FreeBSD.ORG>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220128153014.eb696eb56bf6.Ide1dd041f9b908c5154a600286a7453750b0704a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
drivers/net/wireless/intel/iwlwifi/pcie/tx.c

index c1dfc47..6808445 100644 (file)
@@ -3195,7 +3195,7 @@ static void iwl_mvm_reset_cca_40mhz_workaround(struct iwl_mvm *mvm,
 
        if (he_cap) {
                /* we know that ours is writable */
-               struct ieee80211_sta_he_cap *he = (void *)he_cap;
+               struct ieee80211_sta_he_cap *he = (void *)(uintptr_t)he_cap;
 
                he->he_cap_elem.phy_cap_info[0] |=
                        IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G;
index f8be52e..16665fe 100644 (file)
@@ -191,7 +191,7 @@ static void iwl_mvm_rx_monitor_notif(struct iwl_mvm *mvm,
 
        if (he_cap) {
                /* we know that ours is writable */
-               struct ieee80211_sta_he_cap *he = (void *)he_cap;
+               struct ieee80211_sta_he_cap *he = (void *)(uintptr_t)he_cap;
 
                WARN_ON(!he->has_he);
                WARN_ON(!(he->he_cap_elem.phy_cap_info[0] &
index 34bde8c..c72a84d 100644 (file)
@@ -213,7 +213,7 @@ int iwl_pcie_gen2_enqueue_hcmd(struct iwl_trans *trans,
 
        /* map the remaining (adjusted) nocopy/dup fragments */
        for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
-               const void *data = cmddata[i];
+               void *data = (void *)(uintptr_t)cmddata[i];
 
                if (!cmdlen[i])
                        continue;
@@ -222,7 +222,7 @@ int iwl_pcie_gen2_enqueue_hcmd(struct iwl_trans *trans,
                        continue;
                if (cmd->dataflags[i] & IWL_HCMD_DFL_DUP)
                        data = dup_buf;
-               phys_addr = dma_map_single(trans->dev, (void *)data,
+               phys_addr = dma_map_single(trans->dev, data,
                                           cmdlen[i], DMA_TO_DEVICE);
                if (dma_mapping_error(trans->dev, phys_addr)) {
                        idx = -ENOMEM;
index d54a8df..3c8415f 100644 (file)
@@ -1114,7 +1114,7 @@ int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
 
        /* map the remaining (adjusted) nocopy/dup fragments */
        for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
-               const void *data = cmddata[i];
+               void *data = (void *)(uintptr_t)cmddata[i];
 
                if (!cmdlen[i])
                        continue;
@@ -1123,7 +1123,7 @@ int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
                        continue;
                if (cmd->dataflags[i] & IWL_HCMD_DFL_DUP)
                        data = dup_buf;
-               phys_addr = dma_map_single(trans->dev, (void *)data,
+               phys_addr = dma_map_single(trans->dev, data,
                                           cmdlen[i], DMA_TO_DEVICE);
                if (dma_mapping_error(trans->dev, phys_addr)) {
                        iwl_txq_gen1_tfd_unmap(trans, out_meta, txq,