]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: dsa: rtl8366rb: Fix compilation problem
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 20 Feb 2025 18:48:15 +0000 (19:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2025 17:25:30 +0000 (18:25 +0100)
commit00556b898e40d6d7c7c65977eeeb11b2cd212ec6
treeb5f3044b81dab430b1636bda37e736cd2f3410f7
parentab52446831a7b77408595b71c38b10f12a37c544
net: dsa: rtl8366rb: Fix compilation problem

[ Upstream commit f15176b8b6e72ac30e14fd273282d2b72562d26b ]

When the kernel is compiled without LED framework support the
rtl8366rb fails to build like this:

rtl8366rb.o: in function `rtl8366rb_setup_led':
rtl8366rb.c:953:(.text.unlikely.rtl8366rb_setup_led+0xe8):
  undefined reference to `led_init_default_state_get'
rtl8366rb.c:980:(.text.unlikely.rtl8366rb_setup_led+0x240):
  undefined reference to `devm_led_classdev_register_ext'

As this is constantly coming up in different randconfig builds,
bite the bullet and create a separate file for the offending
code, split out a header with all stuff needed both in the
core driver and the leds code.

Add a new bool Kconfig option for the LED compile target, such
that it depends on LEDS_CLASS=y || LEDS_CLASS=RTL8366RB
which make LED support always available when LEDS_CLASS is
compiled into the kernel and enforce that if the LEDS_CLASS
is a module, then the RTL8366RB driver needs to be a module
as well so that modprobe can resolve the dependencies.

Fixes: 32d617005475 ("net: dsa: realtek: add LED drivers for rtl8366rb")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502070525.xMUImayb-lkp@intel.com/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/realtek/Kconfig
drivers/net/dsa/realtek/Makefile
drivers/net/dsa/realtek/rtl8366rb-leds.c [new file with mode: 0644]
drivers/net/dsa/realtek/rtl8366rb.c
drivers/net/dsa/realtek/rtl8366rb.h [new file with mode: 0644]