rtl8188eu: Fix another API change for kernel 5.17

Struct net_device has been constantified, thus it is no longer OK to
drirectly write the dev_addr, but use dev_addr_set() instead. Starting
with kernel 5.17, improper usage generates a warning.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2022-01-28 20:28:19 -06:00
parent 5b67bc47ea
commit bf23ec4903
2 changed files with 12 additions and 1 deletions

View file

@ -9418,7 +9418,11 @@ static int rtw_mp_efuse_set(struct net_device *dev,
rtw_hal_read_chip_info(padapter);
/* set mac addr*/
rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter));
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
memcpy((void *)padapter->pnetdev->dev_addr, get_hal_mac_addr(padapter), ETH_ALEN); /* set mac addr to net_device */
#else
dev_addr_set(padapter->pnetdev, get_hal_mac_addr(padapter));
#endif
#ifdef CONFIG_P2P
rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter));

View file

@ -946,7 +946,11 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *addr)
}
memcpy(adapter_mac_addr(padapter), sa->sa_data, ETH_ALEN); /* set mac addr to adapter */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
memcpy((void *)pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */
#else
dev_addr_set(pnetdev, sa->sa_data);
#endif
rtw_ps_deny(padapter, PS_DENY_IOCTL);
LeaveAllPowerSaveModeDirect(padapter); /* leave PS mode for guaranteeing to access hw register successfully */
@ -1328,8 +1332,11 @@ static int rtw_os_ndev_register(_adapter *adapter, const char *name)
/* alloc netdev name */
rtw_init_netdev_name(ndev, name);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
memcpy((void *)ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN);
#else
dev_addr_set(adapter->pnetdev, adapter_mac_addr(adapter));
#endif
/* Tell the network stack we exist */