netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: fix circular LEDS_CLASS dependencies
@ 2023-04-20  8:45 Arnd Bergmann
  2023-04-20 15:29 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arnd Bergmann @ 2023-04-20  8:45 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Florian Fainelli, Christian Marangi
  Cc: Arnd Bergmann, Russell King, Frank Sae, Randy Dunlap, netdev,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The CONFIG_PHYLIB symbol is selected by a number of device drivers that
need PHY support, but it now has a dependency on CONFIG_LEDS_CLASS,
which may not be enabled, causing build failures.

Avoid the risk of missing and circular dependencies by guarding the
phylib LED support itself in another Kconfig symbol that can only be
enabled if the dependency is met.

This could be made a hidden symbol and always enabled when both CONFIG_OF
and CONFIG_LEDS_CLASS are reachable from the phylib, but there may be an
advantage in having users see this option when they have a misconfigured
kernel without built-in LED support.

Fixes: 01e5b728e9e4 ("net: phy: Add a binding for PHY LEDs")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/phy/Kconfig      | 9 ++++++++-
 drivers/net/phy/phy_device.c | 3 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index b8cc49820ced..513675ae4dd2 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
 		<Speed in megabits>Mbps OR <Speed in gigabits>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 538523a7cd51..d373446ab5ac 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 */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: phy: fix circular LEDS_CLASS dependencies
  2023-04-20  8:45 [PATCH] net: phy: fix circular LEDS_CLASS dependencies Arnd Bergmann
@ 2023-04-20 15:29 ` Andrew Lunn
  2023-04-21  2:09 ` Jakub Kicinski
  2023-04-21  2:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2023-04-20 15:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Florian Fainelli, Christian Marangi, Arnd Bergmann,
	Russell King, Frank Sae, Randy Dunlap, netdev, linux-kernel

On Thu, Apr 20, 2023 at 10:45:51AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The CONFIG_PHYLIB symbol is selected by a number of device drivers that
> need PHY support, but it now has a dependency on CONFIG_LEDS_CLASS,
> which may not be enabled, causing build failures.
> 
> Avoid the risk of missing and circular dependencies by guarding the
> phylib LED support itself in another Kconfig symbol that can only be
> enabled if the dependency is met.
> 
> This could be made a hidden symbol and always enabled when both CONFIG_OF
> and CONFIG_LEDS_CLASS are reachable from the phylib, but there may be an
> advantage in having users see this option when they have a misconfigured
> kernel without built-in LED support.
> 
> Fixes: 01e5b728e9e4 ("net: phy: Add a binding for PHY LEDs")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

This is for net-next.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: phy: fix circular LEDS_CLASS dependencies
  2023-04-20  8:45 [PATCH] net: phy: fix circular LEDS_CLASS dependencies Arnd Bergmann
  2023-04-20 15:29 ` Andrew Lunn
@ 2023-04-21  2:09 ` Jakub Kicinski
  2023-04-21  2:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2023-04-21  2:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Paolo Abeni, Florian Fainelli, Christian Marangi, Arnd Bergmann,
	Russell King, Frank Sae, Randy Dunlap, netdev, linux-kernel

On Thu, 20 Apr 2023 10:45:51 +0200 Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The CONFIG_PHYLIB symbol is selected by a number of device drivers that
> need PHY support, but it now has a dependency on CONFIG_LEDS_CLASS,
> which may not be enabled, causing build failures.
> 
> Avoid the risk of missing and circular dependencies by guarding the
> phylib LED support itself in another Kconfig symbol that can only be
> enabled if the dependency is met.
> 
> This could be made a hidden symbol and always enabled when both CONFIG_OF
> and CONFIG_LEDS_CLASS are reachable from the phylib, but there may be an
> advantage in having users see this option when they have a misconfigured
> kernel without built-in LED support.

The problem is breaking build for the config I use in testing,
so let me apply without waiting full review period. Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: phy: fix circular LEDS_CLASS dependencies
  2023-04-20  8:45 [PATCH] net: phy: fix circular LEDS_CLASS dependencies Arnd Bergmann
  2023-04-20 15:29 ` Andrew Lunn
  2023-04-21  2:09 ` Jakub Kicinski
@ 2023-04-21  2:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-04-21  2:20 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: andrew, hkallweit1, davem, edumazet, kuba, pabeni, f.fainelli,
	ansuelsmth, arnd, linux, Frank.Sae, rdunlap, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 20 Apr 2023 10:45:51 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The CONFIG_PHYLIB symbol is selected by a number of device drivers that
> need PHY support, but it now has a dependency on CONFIG_LEDS_CLASS,
> which may not be enabled, causing build failures.
> 
> Avoid the risk of missing and circular dependencies by guarding the
> phylib LED support itself in another Kconfig symbol that can only be
> enabled if the dependency is met.
> 
> [...]

Here is the summary with links:
  - net: phy: fix circular LEDS_CLASS dependencies
    https://git.kernel.org/netdev/net-next/c/4bb7aac70b5d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-21  2:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-20  8:45 [PATCH] net: phy: fix circular LEDS_CLASS dependencies Arnd Bergmann
2023-04-20 15:29 ` Andrew Lunn
2023-04-21  2:09 ` Jakub Kicinski
2023-04-21  2:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).