Linux 5.15 compat: use dev_addr_set

This commit is contained in:
Rin Cat (鈴猫) 2022-03-02 20:14:08 -05:00
parent 5f6ef2ff4f
commit a543f246e3
No known key found for this signature in database
GPG Key ID: 2F3A6F9E2721BF2A

View File

@ -1621,7 +1621,11 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *addr)
}
_rtw_memcpy(adapter_mac_addr(padapter), sa->sa_data, ETH_ALEN); /* set mac addr to adapter */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
dev_addr_set(pnetdev, sa->sa_data);
#else
_rtw_memcpy(pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */
#endif
#if 0
if (rtw_is_hw_init_completed(padapter)) {
@ -2157,7 +2161,11 @@ 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))
dev_addr_set(ndev, adapter_mac_addr(adapter));
#else
_rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN);
#endif
#ifdef CONFIG_NET_NS
dev_net_set(ndev, wiphy_net(adapter_to_wiphy(adapter)));