Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

r8169: fix building with CONFIG_LEDS_CLASS=m

When r8169 is built-in but LED support is a loadable module, the new
code to drive the LED causes a link failure:

ld: drivers/net/ethernet/realtek/r8169_leds.o: in function `rtl8168_init_leds':
r8169_leds.c:(.text+0x36c): undefined reference to `devm_led_classdev_register_ext'

LED support is an optional feature, so fix this issue by adding a Kconfig
symbol R8169_LEDS that is guaranteed to be false if r8169 is built-in
and LED core support is a module. As a positive side effect of this change
r8169_leds.o no longer is built under this configuration.

Fixes: 18764b883e15 ("r8169: add support for LED's on RTL8168/RTL8101")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312281159.9TPeXbNd-lkp@intel.com/
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Simon Horman <horms@kernel.org> # build-tested
Tested-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/d055aeb5-fe5c-4ccf-987f-5af93a17537b@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
a2634a5f 14d0681b

+11 -7
+7
drivers/net/ethernet/realtek/Kconfig
··· 113 113 To compile this driver as a module, choose M here: the module 114 114 will be called r8169. This is recommended. 115 115 116 + config R8169_LEDS 117 + def_bool R8169 && LEDS_TRIGGER_NETDEV 118 + depends on !(R8169=y && LEDS_CLASS=m) 119 + help 120 + Optional support for controlling the NIC LED's with the netdev 121 + LED trigger. 122 + 116 123 endif # NET_VENDOR_REALTEK
+2 -4
drivers/net/ethernet/realtek/Makefile
··· 6 6 obj-$(CONFIG_8139CP) += 8139cp.o 7 7 obj-$(CONFIG_8139TOO) += 8139too.o 8 8 obj-$(CONFIG_ATP) += atp.o 9 - r8169-objs += r8169_main.o r8169_firmware.o r8169_phy_config.o 10 - ifdef CONFIG_LEDS_TRIGGER_NETDEV 11 - r8169-objs += r8169_leds.o 12 - endif 9 + r8169-y += r8169_main.o r8169_firmware.o r8169_phy_config.o 10 + r8169-$(CONFIG_R8169_LEDS) += r8169_leds.o 13 11 obj-$(CONFIG_R8169) += r8169.o
+2 -3
drivers/net/ethernet/realtek/r8169_main.c
··· 5356 5356 if (rc) 5357 5357 return rc; 5358 5358 5359 - #if IS_REACHABLE(CONFIG_LEDS_CLASS) && IS_ENABLED(CONFIG_LEDS_TRIGGER_NETDEV) 5360 - if (tp->mac_version > RTL_GIGA_MAC_VER_06 && 5359 + if (IS_ENABLED(CONFIG_R8169_LEDS) && 5360 + tp->mac_version > RTL_GIGA_MAC_VER_06 && 5361 5361 tp->mac_version < RTL_GIGA_MAC_VER_61) 5362 5362 rtl8168_init_leds(dev); 5363 - #endif 5364 5363 5365 5364 netdev_info(dev, "%s, %pM, XID %03x, IRQ %d\n", 5366 5365 rtl_chip_infos[chipset].name, dev->dev_addr, xid, tp->irq);