Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH] leds: Change devm_led_classdev_register_ext stub logic to use IS_REACHABLE
@ 2023-12-28  8:55 Heiner Kallweit
  2024-01-09  8:37 ` Lee Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2023-12-28  8:55 UTC (permalink / raw)
  To: Pavel Machek, Lee Jones, Andrew Lunn; +Cc: linux-leds@vger.kernel.org

If CONFIG_LEDS_CLASS = m and the caller of devm_led_classdev_register
is built-in, we get a compile/link error.
To avoid this we could add conditional compiling to the caller, but
exactly this overhead we wanted to avoid with adding the stubs.
Easiest solution is to use the existing stub also in case IS_ENABLED
is true, but IS_REACHABLE is false.

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/
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 include/linux/leds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/leds.h b/include/linux/leds.h
index 4754b02d3..1eecee316 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -279,7 +279,7 @@ static inline int led_classdev_register(struct device *parent,
 	return led_classdev_register_ext(parent, led_cdev, NULL);
 }
 
-#if IS_ENABLED(CONFIG_LEDS_CLASS)
+#if IS_REACHABLE(CONFIG_LEDS_CLASS)
 int devm_led_classdev_register_ext(struct device *parent,
 					  struct led_classdev *led_cdev,
 					  struct led_init_data *init_data);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] leds: Change devm_led_classdev_register_ext stub logic to use IS_REACHABLE
  2023-12-28  8:55 [PATCH] leds: Change devm_led_classdev_register_ext stub logic to use IS_REACHABLE Heiner Kallweit
@ 2024-01-09  8:37 ` Lee Jones
  2024-01-09  9:04   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Lee Jones @ 2024-01-09  8:37 UTC (permalink / raw)
  To: Heiner Kallweit, arnd
  Cc: Pavel Machek, Andrew Lunn, linux-leds@vger.kernel.org

On Thu, 28 Dec 2023, Heiner Kallweit wrote:

> If CONFIG_LEDS_CLASS = m and the caller of devm_led_classdev_register
> is built-in, we get a compile/link error.
> To avoid this we could add conditional compiling to the caller, but
> exactly this overhead we wanted to avoid with adding the stubs.
> Easiest solution is to use the existing stub also in case IS_ENABLED
> is true, but IS_REACHABLE is false.
> 
> 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/
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  include/linux/leds.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Arnd pretty much NACKed this, right?

https://lore.kernel.org/r/b310230b-f20b-489a-97ed-908df193a942@app.fastmail.com

> diff --git a/include/linux/leds.h b/include/linux/leds.h
> index 4754b02d3..1eecee316 100644
> --- a/include/linux/leds.h
> +++ b/include/linux/leds.h
> @@ -279,7 +279,7 @@ static inline int led_classdev_register(struct device *parent,
>  	return led_classdev_register_ext(parent, led_cdev, NULL);
>  }
>  
> -#if IS_ENABLED(CONFIG_LEDS_CLASS)
> +#if IS_REACHABLE(CONFIG_LEDS_CLASS)
>  int devm_led_classdev_register_ext(struct device *parent,
>  					  struct led_classdev *led_cdev,
>  					  struct led_init_data *init_data);
> -- 
> 2.43.0
> 

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] leds: Change devm_led_classdev_register_ext stub logic to use IS_REACHABLE
  2024-01-09  8:37 ` Lee Jones
@ 2024-01-09  9:04   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2024-01-09  9:04 UTC (permalink / raw)
  To: Lee Jones, Heiner Kallweit
  Cc: Pavel Machek, Andrew Lunn, linux-leds@vger.kernel.org

On Tue, Jan 9, 2024, at 09:37, Lee Jones wrote:
> On Thu, 28 Dec 2023, Heiner Kallweit wrote:
>
>> If CONFIG_LEDS_CLASS = m and the caller of devm_led_classdev_register
>> is built-in, we get a compile/link error.
>> To avoid this we could add conditional compiling to the caller, but
>> exactly this overhead we wanted to avoid with adding the stubs.
>> Easiest solution is to use the existing stub also in case IS_ENABLED
>> is true, but IS_REACHABLE is false.
>> 
>> 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/
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  include/linux/leds.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Arnd pretty much NACKed this, right?
>
> https://lore.kernel.org/r/b310230b-f20b-489a-97ed-908df193a942@app.fastmail.com

Yes, I actually wrote a replacement that does the opposite,
I just need to send that out.

    Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-09  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-28  8:55 [PATCH] leds: Change devm_led_classdev_register_ext stub logic to use IS_REACHABLE Heiner Kallweit
2024-01-09  8:37 ` Lee Jones
2024-01-09  9:04   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox