diff --git a/ioctl_linux.c b/ioctl_linux.c index ed6f8fd..640795e 100644 --- a/ioctl_linux.c +++ b/ioctl_linux.c @@ -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)); diff --git a/os_intfs.c b/os_intfs.c index f8c5ed7..2f5dc6c 100644 --- a/os_intfs.c +++ b/os_intfs.c @@ -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 */