diff mbox series

igc: fix LEDS_CLASS dependency

Message ID 20240222100324.453272-1-arnd@kernel.org (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series igc: fix LEDS_CLASS dependency | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 1 blamed authors not CCed: kurt@linutronix.de; 1 maintainers not CCed: kurt@linutronix.de
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-22--12-00 (tests: 1454)

Commit Message

Arnd Bergmann Feb. 22, 2024, 10:02 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

When IGC is built-in but LEDS_CLASS is a loadable module, there is
a link failure:

x86_64-linux-ld: drivers/net/ethernet/intel/igc/igc_leds.o: in function `igc_led_setup':
igc_leds.c:(.text+0x75c): undefined reference to `devm_led_classdev_register_ext'

Add another dependency that prevents this combination.

Fixes: ea578703b03d ("igc: Add support for LEDs on i225/i226")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/intel/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Kurt Kanzenbach Feb. 22, 2024, 10:18 a.m. UTC | #1
On Thu Feb 22 2024, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When IGC is built-in but LEDS_CLASS is a loadable module, there is
> a link failure:
>
> x86_64-linux-ld: drivers/net/ethernet/intel/igc/igc_leds.o: in function `igc_led_setup':
> igc_leds.c:(.text+0x75c): undefined reference to `devm_led_classdev_register_ext'
>
> Add another dependency that prevents this combination.
>
> Fixes: ea578703b03d ("igc: Add support for LEDs on i225/i226")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Ops, sorry. I tried to build all different combinations, but obviously
failed. Thanks for fixing this.

Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
Paul Menzel Feb. 22, 2024, 10:21 a.m. UTC | #2
Dear Arnd,


Thank you for the patch.


Am 22.02.24 um 11:02 schrieb Arnd Bergmann:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When IGC is built-in but LEDS_CLASS is a loadable module, there is
> a link failure:
> 
> x86_64-linux-ld: drivers/net/ethernet/intel/igc/igc_leds.o: in function `igc_led_setup':
> igc_leds.c:(.text+0x75c): undefined reference to `devm_led_classdev_register_ext'
> 
> Add another dependency that prevents this combination.
> 
> Fixes: ea578703b03d ("igc: Add support for LEDs on i225/i226")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/net/ethernet/intel/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
> index af7fa6856707..6e7901e12699 100644
> --- a/drivers/net/ethernet/intel/Kconfig
> +++ b/drivers/net/ethernet/intel/Kconfig
> @@ -372,6 +372,7 @@ config IGC
>   config IGC_LEDS
>   	def_bool LEDS_TRIGGER_NETDEV
>   	depends on IGC && LEDS_CLASS
> +	depends on LEDS_CLASS=y || IGC=m

Should it be ordered as the line above?

>   	help
>   	  Optional support for controlling the NIC LED's with the netdev
>   	  LED trigger.


Kind regards,

Paul
Tony Nguyen Feb. 23, 2024, 11:15 p.m. UTC | #3
On 2/22/2024 2:02 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When IGC is built-in but LEDS_CLASS is a loadable module, there is
> a link failure:
> 
> x86_64-linux-ld: drivers/net/ethernet/intel/igc/igc_leds.o: in function `igc_led_setup':
> igc_leds.c:(.text+0x75c): undefined reference to `devm_led_classdev_register_ext'
> 
> Add another dependency that prevents this combination.
> 
> Fixes: ea578703b03d ("igc: Add support for LEDs on i225/i226")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/net/ethernet/intel/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
> index af7fa6856707..6e7901e12699 100644
> --- a/drivers/net/ethernet/intel/Kconfig
> +++ b/drivers/net/ethernet/intel/Kconfig
> @@ -372,6 +372,7 @@ config IGC
>   config IGC_LEDS
>   	def_bool LEDS_TRIGGER_NETDEV
>   	depends on IGC && LEDS_CLASS
> +	depends on LEDS_CLASS=y || IGC=m

I don't know kbuild that well, but would this cover LEDS_CLASS=n with IGC=m?

There are Similar checks in the file [1][2] that would transpose to
  depends on IGC && LEDS_CLASS && !(IGC=y && LEDS_CLASS=m)

which should cover that and keep the checks in the file consistent. IMO 
a little more readable as well.

Thanks,
Tony

[1] 
https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/intel/Kconfig#L109
[2] 
https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/intel/Kconfig#L161

>   	help
>   	  Optional support for controlling the NIC LED's with the netdev
>   	  LED trigger.
Arnd Bergmann Feb. 24, 2024, 7:50 a.m. UTC | #4
On Sat, Feb 24, 2024, at 00:15, Tony Nguyen wrote:
> On 2/22/2024 2:02 AM, Arnd Bergmann wrote:
>> 
>> diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
>> index af7fa6856707..6e7901e12699 100644
>> --- a/drivers/net/ethernet/intel/Kconfig
>> +++ b/drivers/net/ethernet/intel/Kconfig
>> @@ -372,6 +372,7 @@ config IGC
>>   config IGC_LEDS
>>   	def_bool LEDS_TRIGGER_NETDEV
>>   	depends on IGC && LEDS_CLASS
>> +	depends on LEDS_CLASS=y || IGC=m
>
> I don't know kbuild that well, but would this cover LEDS_CLASS=n with IGC=m?

The 'depends on LEDS_CLASS' take care of that.

> There are Similar checks in the file [1][2] that would transpose to
>   depends on IGC && LEDS_CLASS && !(IGC=y && LEDS_CLASS=m)
>
> which should cover that and keep the checks in the file consistent. IMO 
> a little more readable as well.

Right, that works as well. I find the negative dependencies
slightly more confusing, they should do the same thing here.
Please apply whichever version makes most sense to you then.

     Arnd
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
index af7fa6856707..6e7901e12699 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -372,6 +372,7 @@  config IGC
 config IGC_LEDS
 	def_bool LEDS_TRIGGER_NETDEV
 	depends on IGC && LEDS_CLASS
+	depends on LEDS_CLASS=y || IGC=m
 	help
 	  Optional support for controlling the NIC LED's with the netdev
 	  LED trigger.