marvell: oak: Fix build for Linux v5.14

The functions eth_hw_addr_set() and dev_addr_mod() do not exist for
Linux v5.14 and so compiling the marvell oak driver fails for Linux
v5.14. Fix this by calling memcpy() instead of eth_hw_addr_set() and
dev_addr_mod() for Linux v5.14. Note that both eth_hw_addr_set() and
dev_addr_mod() internally call memcpy() and so this is equivalent.

Bug 3820317

Change-Id: I4b49e031383adf62a55f1d01e8de2fcc0ad47862
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2875022
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2023-03-22 10:39:41 +00:00
committed by mobile promotions
parent c0028fc442
commit b5ec750ebb
2 changed files with 12 additions and 1 deletions

View File

@@ -12,6 +12,8 @@
* disclaimer.
*
*/
#include <linux/version.h>
#include "oak_net.h"
#include "oak_ethtool.h"
#include "oak_chksum.h"
@@ -630,8 +632,11 @@ int oak_net_set_mac_addr(struct net_device *dev, void *p_addr)
if (rc == 0) {
rc = -EINVAL;
} else {
//memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
dev_addr_mod(dev, 0, addr->sa_data, ETH_ALEN);
#else
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
#endif
/* When an interface come up we need to remember the
* MAC address of an interface. Because the same MAC