Commit a5e4bd99 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

of_mdio: select fixed phy support unconditionally

Calling the fixed-phy functions when CONFIG_FIXED_PHY=m as a previous
change tried cannot work if the caller is in built-in code:

drivers/of/built-in.o: In function `of_phy_register_fixed_link':
of_reserved_mem.c:(.text+0x85e0): undefined reference to `fixed_phy_register'

Making of_mdio depend on 'FIXED_PHY || !FIXED_PHY' would solve this
dependency by enforcing that OF_MDIO itself becomes a loadable module
when FIXED_PHY=y, but that creates a different dependency as it
breaks any built-in ethernet driver that uses of_mdio.

Making FIXED_PHY a bool option also cannot work, since it depends on
PHYLIB, which again is tristate.

This version now uses 'select FIXED_PHY' to ensure that the fixed-phy
portion of of_mdio is not optional. The main downside of this is
a small increase in code size for cases that do not need fixed phy
support, but it should avoid all of the link-time problems.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Fixes: d1bd330a ("of_mdio: Enable fixed PHY support if driver is a module")
Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 56e2f23b
...@@ -74,6 +74,7 @@ config OF_NET ...@@ -74,6 +74,7 @@ config OF_NET
config OF_MDIO config OF_MDIO
def_tristate PHYLIB def_tristate PHYLIB
depends on PHYLIB depends on PHYLIB
select FIXED_PHY
help help
OpenFirmware MDIO bus (Ethernet PHY) accessors OpenFirmware MDIO bus (Ethernet PHY) accessors
......
...@@ -361,7 +361,6 @@ struct phy_device *of_phy_attach(struct net_device *dev, ...@@ -361,7 +361,6 @@ struct phy_device *of_phy_attach(struct net_device *dev,
} }
EXPORT_SYMBOL(of_phy_attach); EXPORT_SYMBOL(of_phy_attach);
#if IS_ENABLED(CONFIG_FIXED_PHY)
/* /*
* of_phy_is_fixed_link() and of_phy_register_fixed_link() must * of_phy_is_fixed_link() and of_phy_register_fixed_link() must
* support two DT bindings: * support two DT bindings:
...@@ -451,4 +450,3 @@ int of_phy_register_fixed_link(struct device_node *np) ...@@ -451,4 +450,3 @@ int of_phy_register_fixed_link(struct device_node *np)
return -ENODEV; return -ENODEV;
} }
EXPORT_SYMBOL(of_phy_register_fixed_link); EXPORT_SYMBOL(of_phy_register_fixed_link);
#endif
...@@ -25,6 +25,8 @@ struct phy_device *of_phy_attach(struct net_device *dev, ...@@ -25,6 +25,8 @@ struct phy_device *of_phy_attach(struct net_device *dev,
extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np); extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
extern int of_phy_register_fixed_link(struct device_node *np);
extern bool of_phy_is_fixed_link(struct device_node *np);
#else /* CONFIG_OF */ #else /* CONFIG_OF */
static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
...@@ -67,12 +69,6 @@ static inline int of_mdio_parse_addr(struct device *dev, ...@@ -67,12 +69,6 @@ static inline int of_mdio_parse_addr(struct device *dev,
{ {
return -ENOSYS; return -ENOSYS;
} }
#endif /* CONFIG_OF */
#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_FIXED_PHY)
extern int of_phy_register_fixed_link(struct device_node *np);
extern bool of_phy_is_fixed_link(struct device_node *np);
#else
static inline int of_phy_register_fixed_link(struct device_node *np) static inline int of_phy_register_fixed_link(struct device_node *np)
{ {
return -ENOSYS; return -ENOSYS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment