diff mbox series

[7/8] headers: backport device_get_mac_address api change

Message ID 20221013085351.14516-7-nbd@nbd.name (mailing list archive)
State New, archived
Headers show
Series [1/8] headers: backport napi add functions | expand

Commit Message

Felix Fietkau Oct. 13, 2022, 8:53 a.m. UTC
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/etherdevice.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/backport/backport-include/linux/etherdevice.h b/backport/backport-include/linux/etherdevice.h
index f6fa51f3829c..51a7d6d73f7e 100644
--- a/backport/backport-include/linux/etherdevice.h
+++ b/backport/backport-include/linux/etherdevice.h
@@ -2,6 +2,7 @@ 
 #define _BACKPORT_LINUX_ETHERDEVICE_H
 #include_next <linux/etherdevice.h>
 #include <linux/version.h>
+#include <linux/property.h>
 
 
 #if LINUX_VERSION_IS_LESS(4,11,0)
@@ -52,4 +53,15 @@  static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr)
 }
 #endif /* LINUX_VERSION_IS_LESS(5,15,0) */
 
+#if LINUX_VERSION_IS_LESS(5,16,0)
+static inline int backport_device_get_mac_address(struct device *dev, char *addr)
+{
+	if (!device_get_mac_address(dev, addr, ETH_ALEN))
+		return -ENOENT;
+
+	return 0;
+}
+#define device_get_mac_address LINUX_BACKPORT(device_get_mac_address)
+#endif /* LINUX_VERSION_IS_LESS(5,16,0) */
+
 #endif /* _BACKPORT_LINUX_ETHERDEVICE_H */