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

leds: Fix ifdef check for gpio_led_register_device()

gpio_led_register_device() is built whenever CONFIG_LEDS_GPIO_REGISTER is
enabled, and this may be used even when CONFIG_NEW_LEDS is turned off.

However, the stub declaration in the header is provided for all configs
without CONFIG_NEW_LEDS, resulting in a build failure:

drivers/leds/leds-gpio-register.c:24:1: error: redefinition of 'gpio_led_register_device'
24 | gpio_led_register_device(int id, const struct gpio_led_platform_data *pdata)
| ^
include/linux/leds.h:646:39: note: previous definition is here

Change the #ifdef check to match the definition.
Note: this apparently took years of randconfig builds to hit, since
a number of other drivers just 'select NEW_LEDS' anyway.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240228093834.2230004-1-arnd@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Arnd Bergmann and committed by
Lee Jones
08b7dab9 6c27bf4c

+1 -1
+1 -1
include/linux/leds.h
··· 639 639 gpio_blink_set_t gpio_blink_set; 640 640 }; 641 641 642 - #ifdef CONFIG_NEW_LEDS 642 + #ifdef CONFIG_LEDS_GPIO_REGISTER 643 643 struct platform_device *gpio_led_register_device( 644 644 int id, const struct gpio_led_platform_data *pdata); 645 645 #else