2
0

820-v6.4-net-phy-fix-circular-LEDS_CLASS-dependencies.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From 4bb7aac70b5d8a4bddf4ee0791b834f9f56883d2 Mon Sep 17 00:00:00 2001
  2. From: Arnd Bergmann <[email protected]>
  3. Date: Thu, 20 Apr 2023 10:45:51 +0200
  4. Subject: [PATCH] net: phy: fix circular LEDS_CLASS dependencies
  5. The CONFIG_PHYLIB symbol is selected by a number of device drivers that
  6. need PHY support, but it now has a dependency on CONFIG_LEDS_CLASS,
  7. which may not be enabled, causing build failures.
  8. Avoid the risk of missing and circular dependencies by guarding the
  9. phylib LED support itself in another Kconfig symbol that can only be
  10. enabled if the dependency is met.
  11. This could be made a hidden symbol and always enabled when both CONFIG_OF
  12. and CONFIG_LEDS_CLASS are reachable from the phylib, but there may be an
  13. advantage in having users see this option when they have a misconfigured
  14. kernel without built-in LED support.
  15. Fixes: 01e5b728e9e4 ("net: phy: Add a binding for PHY LEDs")
  16. Signed-off-by: Arnd Bergmann <[email protected]>
  17. Reviewed-by: Andrew Lunn <[email protected]>
  18. Link: https://lore.kernel.org/r/[email protected]
  19. Signed-off-by: Jakub Kicinski <[email protected]>
  20. ---
  21. drivers/net/phy/Kconfig | 9 ++++++++-
  22. drivers/net/phy/phy_device.c | 3 ++-
  23. 2 files changed, 10 insertions(+), 2 deletions(-)
  24. --- a/drivers/net/phy/Kconfig
  25. +++ b/drivers/net/phy/Kconfig
  26. @@ -18,7 +18,6 @@ menuconfig PHYLIB
  27. depends on NETDEVICES
  28. select MDIO_DEVICE
  29. select MDIO_DEVRES
  30. - depends on LEDS_CLASS || LEDS_CLASS=n
  31. help
  32. Ethernet controllers are usually attached to PHY
  33. devices. This option provides infrastructure for
  34. @@ -45,6 +44,14 @@ config LED_TRIGGER_PHY
  35. <Speed in megabits>Mbps OR <Speed in gigabits>Gbps OR link
  36. for any speed known to the PHY.
  37. +config PHYLIB_LEDS
  38. + bool "Support probing LEDs from device tree"
  39. + depends on LEDS_CLASS=y || LEDS_CLASS=PHYLIB
  40. + depends on OF
  41. + default y
  42. + help
  43. + When LED class support is enabled, phylib can automatically
  44. + probe LED setting from device tree.
  45. config FIXED_PHY
  46. tristate "MDIO Bus/PHY emulation with fixed speed/link PHYs"
  47. --- a/drivers/net/phy/phy_device.c
  48. +++ b/drivers/net/phy/phy_device.c
  49. @@ -3210,7 +3210,8 @@ static int phy_probe(struct device *dev)
  50. /* Get the LEDs from the device tree, and instantiate standard
  51. * LEDs for them.
  52. */
  53. - err = of_phy_leds(phydev);
  54. + if (IS_ENABLED(CONFIG_PHYLIB_LEDS))
  55. + err = of_phy_leds(phydev);
  56. out:
  57. /* Re-assert the reset signal on error */