780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From a2634a5ffcafc31c343c6153ae487eb184c433a6 Mon Sep 17 00:00:00 2001
  2. From: Heiner Kallweit <[email protected]>
  3. Date: Wed, 3 Jan 2024 16:52:04 +0100
  4. Subject: [PATCH] r8169: fix building with CONFIG_LEDS_CLASS=m
  5. When r8169 is built-in but LED support is a loadable module, the new
  6. code to drive the LED causes a link failure:
  7. ld: drivers/net/ethernet/realtek/r8169_leds.o: in function `rtl8168_init_leds':
  8. r8169_leds.c:(.text+0x36c): undefined reference to `devm_led_classdev_register_ext'
  9. LED support is an optional feature, so fix this issue by adding a Kconfig
  10. symbol R8169_LEDS that is guaranteed to be false if r8169 is built-in
  11. and LED core support is a module. As a positive side effect of this change
  12. r8169_leds.o no longer is built under this configuration.
  13. Fixes: 18764b883e15 ("r8169: add support for LED's on RTL8168/RTL8101")
  14. Reported-by: kernel test robot <[email protected]>
  15. Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
  16. Suggested-by: Arnd Bergmann <[email protected]>
  17. Signed-off-by: Heiner Kallweit <[email protected]>
  18. Reviewed-by: Simon Horman <[email protected]>
  19. Tested-by: Simon Horman <[email protected]> # build-tested
  20. Tested-by: Arnd Bergmann <[email protected]>
  21. Link: https://lore.kernel.org/r/[email protected]
  22. Signed-off-by: Jakub Kicinski <[email protected]>
  23. ---
  24. drivers/net/ethernet/realtek/Kconfig | 7 +++++++
  25. drivers/net/ethernet/realtek/Makefile | 6 ++----
  26. drivers/net/ethernet/realtek/r8169_main.c | 5 ++---
  27. 3 files changed, 11 insertions(+), 7 deletions(-)
  28. --- a/drivers/net/ethernet/realtek/Kconfig
  29. +++ b/drivers/net/ethernet/realtek/Kconfig
  30. @@ -113,4 +113,11 @@ config R8169
  31. To compile this driver as a module, choose M here: the module
  32. will be called r8169. This is recommended.
  33. +config R8169_LEDS
  34. + def_bool R8169 && LEDS_TRIGGER_NETDEV
  35. + depends on !(R8169=y && LEDS_CLASS=m)
  36. + help
  37. + Optional support for controlling the NIC LED's with the netdev
  38. + LED trigger.
  39. +
  40. endif # NET_VENDOR_REALTEK
  41. --- a/drivers/net/ethernet/realtek/Makefile
  42. +++ b/drivers/net/ethernet/realtek/Makefile
  43. @@ -6,8 +6,6 @@
  44. obj-$(CONFIG_8139CP) += 8139cp.o
  45. obj-$(CONFIG_8139TOO) += 8139too.o
  46. obj-$(CONFIG_ATP) += atp.o
  47. -r8169-objs += r8169_main.o r8169_firmware.o r8169_phy_config.o
  48. -ifdef CONFIG_LEDS_TRIGGER_NETDEV
  49. -r8169-objs += r8169_leds.o
  50. -endif
  51. +r8169-y += r8169_main.o r8169_firmware.o r8169_phy_config.o
  52. +r8169-$(CONFIG_R8169_LEDS) += r8169_leds.o
  53. obj-$(CONFIG_R8169) += r8169.o
  54. --- a/drivers/net/ethernet/realtek/r8169_main.c
  55. +++ b/drivers/net/ethernet/realtek/r8169_main.c
  56. @@ -5418,11 +5418,10 @@ static int rtl_init_one(struct pci_dev *
  57. if (rc)
  58. return rc;
  59. -#if IS_REACHABLE(CONFIG_LEDS_CLASS) && IS_ENABLED(CONFIG_LEDS_TRIGGER_NETDEV)
  60. - if (tp->mac_version > RTL_GIGA_MAC_VER_06 &&
  61. + if (IS_ENABLED(CONFIG_R8169_LEDS) &&
  62. + tp->mac_version > RTL_GIGA_MAC_VER_06 &&
  63. tp->mac_version < RTL_GIGA_MAC_VER_61)
  64. rtl8168_init_leds(dev);
  65. -#endif
  66. netdev_info(dev, "%s, %pM, XID %03x, IRQ %d\n",
  67. rtl_chip_infos[chipset].name, dev->dev_addr, xid, tp->irq);