linux-stable/include/linux/of_net.h
Arnd Bergmann 8b017fbe0b net: of: fix stub of_net helpers for CONFIG_NET=n
Moving the of_net code from drivers/of/ to net/core means we
no longer stub out the helpers when networking is disabled,
which leads to a randconfig build failure with at least one
ARM platform that calls this from non-networking code:

arm-linux-gnueabi-ld: arch/arm/mach-mvebu/kirkwood.o: in function `kirkwood_dt_eth_fixup':
kirkwood.c:(.init.text+0x54): undefined reference to `of_get_mac_address'

Restore the way this worked before by changing that #ifdef
check back to testing for both CONFIG_OF and CONFIG_NET.

Fixes: e330fb1459 ("of: net: move of_net under net/")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20211014090055.2058949-1-arnd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-10-14 15:59:04 -07:00

42 lines
1,009 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* OF helpers for network devices.
*/
#ifndef __LINUX_OF_NET_H
#define __LINUX_OF_NET_H
#include <linux/phy.h>
#if defined(CONFIG_OF) && defined(CONFIG_NET)
#include <linux/of.h>
struct net_device;
extern int of_get_phy_mode(struct device_node *np, phy_interface_t *interface);
extern int of_get_mac_address(struct device_node *np, u8 *mac);
int of_get_ethdev_address(struct device_node *np, struct net_device *dev);
extern struct net_device *of_find_net_device_by_node(struct device_node *np);
#else
static inline int of_get_phy_mode(struct device_node *np,
phy_interface_t *interface)
{
return -ENODEV;
}
static inline int of_get_mac_address(struct device_node *np, u8 *mac)
{
return -ENODEV;
}
static inline int of_get_ethdev_address(struct device_node *np, struct net_device *dev)
{
return -ENODEV;
}
static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
{
return NULL;
}
#endif
#endif /* __LINUX_OF_NET_H */