diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index b8cc49820cedd..513675ae4dd29 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -18,7 +18,6 @@ menuconfig PHYLIB depends on NETDEVICES select MDIO_DEVICE select MDIO_DEVRES - depends on LEDS_CLASS || LEDS_CLASS=n help Ethernet controllers are usually attached to PHY devices. This option provides infrastructure for @@ -45,6 +44,14 @@ config LED_TRIGGER_PHY Mbps OR Gbps OR link for any speed known to the PHY. +config PHYLIB_LEDS + bool "Support probing LEDs from device tree" + depends on LEDS_CLASS=y || LEDS_CLASS=PHYLIB + depends on OF + default y + help + When LED class support is enabled, phylib can automatically + probe LED setting from device tree. config FIXED_PHY tristate "MDIO Bus/PHY emulation with fixed speed/link PHYs" diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 538523a7cd512..d373446ab5acd 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3284,7 +3284,8 @@ static int phy_probe(struct device *dev) /* Get the LEDs from the device tree, and instantiate standard * LEDs for them. */ - err = of_phy_leds(phydev); + if (IS_ENABLED(CONFIG_PHYLIB_LEDS)) + err = of_phy_leds(phydev); out: /* Re-assert the reset signal on error */