From 87d308708712ff6075c4dd54b0519b47fdad8816 Mon Sep 17 00:00:00 2001 From: Oleksandr Suvorov Date: Thu, 26 Mar 2020 12:44:27 +0200 Subject: Backports v5.4.27 Backports generated by toradex backports f6e8852f1ef28e6d3c9bae8400eb6a87a6b0c3e7 against mainline kernel tag v5.4.27 Signed-off-by: Oleksandr Suvorov --- backport-include/linux/of_net.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 backport-include/linux/of_net.h (limited to 'backport-include/linux/of_net.h') diff --git a/backport-include/linux/of_net.h b/backport-include/linux/of_net.h new file mode 100644 index 0000000..18becf5 --- /dev/null +++ b/backport-include/linux/of_net.h @@ -0,0 +1,31 @@ +#ifndef _BP_OF_NET_H +#define _BP_OF_NET_H +#include_next +#include + +#ifndef CONFIG_OF +#if LINUX_VERSION_IS_LESS(3,10,0) +static inline const void *of_get_mac_address(struct device_node *np) +{ + return NULL; +} +#endif +#endif + +/* The behavior of of_get_mac_address() changed in kernel 5.2, it now + * returns an error code and not NULL in case of an error. + */ +#if LINUX_VERSION_IS_LESS(5,2,0) +static inline const void *backport_of_get_mac_address(struct device_node *np) +{ + const void *mac = of_get_mac_address(np); + + if (!mac) + return ERR_PTR(-ENODEV); + + return mac; +} +#define of_get_mac_address LINUX_BACKPORT(of_get_mac_address) +#endif /* < 5.2 */ + +#endif /* _BP_OF_NET_H */ -- cgit v1.2.3