Skip to content

Commit a5e4bd9

Browse files
arndbdavem330
authored andcommitted
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: Arnd Bergmann <arnd@arndb.de> Fixes: d1bd330 ("of_mdio: Enable fixed PHY support if driver is a module") Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 56e2f23 commit a5e4bd9

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

drivers/of/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ config OF_NET
7474
config OF_MDIO
7575
def_tristate PHYLIB
7676
depends on PHYLIB
77+
select FIXED_PHY
7778
help
7879
OpenFirmware MDIO bus (Ethernet PHY) accessors
7980

drivers/of/of_mdio.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ struct phy_device *of_phy_attach(struct net_device *dev,
361361
}
362362
EXPORT_SYMBOL(of_phy_attach);
363363

364-
#if IS_ENABLED(CONFIG_FIXED_PHY)
365364
/*
366365
* of_phy_is_fixed_link() and of_phy_register_fixed_link() must
367366
* support two DT bindings:
@@ -451,4 +450,3 @@ int of_phy_register_fixed_link(struct device_node *np)
451450
return -ENODEV;
452451
}
453452
EXPORT_SYMBOL(of_phy_register_fixed_link);
454-
#endif

include/linux/of_mdio.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ struct phy_device *of_phy_attach(struct net_device *dev,
2525

2626
extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
2727
extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
28+
extern int of_phy_register_fixed_link(struct device_node *np);
29+
extern bool of_phy_is_fixed_link(struct device_node *np);
2830

2931
#else /* CONFIG_OF */
3032
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,
6769
{
6870
return -ENOSYS;
6971
}
70-
#endif /* CONFIG_OF */
71-
72-
#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_FIXED_PHY)
73-
extern int of_phy_register_fixed_link(struct device_node *np);
74-
extern bool of_phy_is_fixed_link(struct device_node *np);
75-
#else
7672
static inline int of_phy_register_fixed_link(struct device_node *np)
7773
{
7874
return -ENOSYS;

0 commit comments

Comments
 (0)