mxm_wifiex: fix the net_device::dev_addr build warnings on L5.16

Use eth_hw_addr_set function instead of writing the address directly to
net_device::dev_addr. Make sure we don't cast off const qualifier from
dev->dev_addr. Otherwise will have the build warnings when build the
driver based on L5.16 kernel.

Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Approved-by: Tian Yang <yang.tian@nxp.com>
This commit is contained in:
Sherry Sun 2022-02-15 14:46:39 +08:00
parent 28c2f97672
commit 35da828282
3 changed files with 28 additions and 0 deletions

View File

@ -854,8 +854,12 @@ mlan_status woal_request_set_mac_address(moal_private *priv, t_u8 wait_option)
"set mac address failed! status=%d, error_code=0x%x\n",
status, req->status_code);
} else {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
eth_hw_addr_set(priv->netdev, priv->current_addr);
#else
moal_memcpy_ext(priv->phandle, priv->netdev->dev_addr,
priv->current_addr, ETH_ALEN, ETH_ALEN);
#endif
HEXDUMP("priv->MacAddr:", priv->current_addr, ETH_ALEN);
}
done:
@ -1928,8 +1932,12 @@ mlan_status woal_request_get_fw_info(moal_private *priv, t_u8 wait_option,
moal_memcpy_ext(priv->phandle, priv->current_addr,
&info->param.fw_info.mac_addr,
sizeof(mlan_802_11_mac_addr), ETH_ALEN);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
eth_hw_addr_set(priv->netdev, priv->current_addr);
#else
moal_memcpy_ext(priv->phandle, priv->netdev->dev_addr,
priv->current_addr, ETH_ALEN, ETH_ALEN);
#endif
if (fw_info)
moal_memcpy_ext(priv->phandle, fw_info,
&info->param.fw_info,

View File

@ -2316,6 +2316,13 @@ static t_u32 woal_process_init_cfg(moal_handle *handle, t_u8 *data, t_size size)
"Set MAC address failed\n");
goto done;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
eth_hw_addr_set(
handle->priv[i]
->netdev,
handle->priv[i]
->current_addr);
#else
moal_memcpy_ext(
handle,
handle->priv[i]
@ -2324,6 +2331,7 @@ static t_u32 woal_process_init_cfg(moal_handle *handle, t_u8 *data, t_size size)
handle->priv[i]
->current_addr,
ETH_ALEN, ETH_ALEN);
#endif
index++; /* Mark found one
interface matching
*/
@ -5183,8 +5191,12 @@ int woal_set_mac_address(struct net_device *dev, void *addr)
goto done;
}
HEXDUMP("priv->MacAddr:", priv->current_addr, ETH_ALEN);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
eth_hw_addr_set(dev, priv->current_addr);
#else
moal_memcpy_ext(priv->phandle, dev->dev_addr, priv->current_addr,
ETH_ALEN, ETH_ALEN);
#endif
done:
LEAVE();
return ret;
@ -6603,8 +6615,12 @@ void woal_init_priv(moal_private *priv, t_u8 wait_option)
}
woal_request_set_mac_address(priv, MOAL_IOCTL_WAIT);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
eth_hw_addr_set(priv->netdev, priv->current_addr);
#else
moal_memcpy_ext(priv->phandle, priv->netdev->dev_addr,
priv->current_addr, ETH_ALEN, ETH_ALEN);
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
priv->host_mlme = 0;
priv->auth_flag = 0;

View File

@ -2861,8 +2861,12 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent)
woal_start_queue(priv->netdev);
moal_memcpy_ext(priv->phandle, priv->current_addr,
pmevent->event_buf + 6, ETH_ALEN, ETH_ALEN);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
eth_hw_addr_set(priv->netdev, priv->current_addr);
#else
moal_memcpy_ext(priv->phandle, priv->netdev->dev_addr,
priv->current_addr, ETH_ALEN, ETH_ALEN);
#endif
woal_broadcast_event(priv, pmevent->event_buf,
pmevent->event_len);
#ifdef STA_SUPPORT