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

leds: Make flash and multicolor dependencies unconditional

Along the same lines as making devm_led_classdev_register() declared
extern unconditional, do the same thing for the two sub-classes
that have similar stubs.

The users of these interfaces go to great lengths to allow building
with both the generic leds API and the extended version, but realistically
there is not much use in this, so just simplify it to always rely
on it and remove the confusing fallback logic.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240109090715.982332-2-arnd@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Arnd Bergmann and committed by
Lee Jones
09e3f324 211f8ec9

+5 -79
+2 -2
drivers/leds/Kconfig
··· 399 399 config LEDS_LP50XX 400 400 tristate "LED Support for TI LP5036/30/24/18/12/09 LED driver chip" 401 401 depends on LEDS_CLASS && REGMAP_I2C 402 - depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR 402 + depends on LEDS_CLASS_MULTICOLOR 403 403 help 404 404 If you say yes here you get support for the Texas Instruments 405 405 LP5036, LP5030, LP5024, LP5018, LP5012 and LP5009 LED driver. ··· 410 410 config LEDS_LP55XX_COMMON 411 411 tristate "Common Driver for TI/National LP5521/5523/55231/5562/8501" 412 412 depends on LEDS_CLASS 413 - depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR 413 + depends on LEDS_CLASS_MULTICOLOR 414 414 depends on OF 415 415 depends on I2C 416 416 select FW_LOADER
+2 -2
drivers/leds/flash/Kconfig
··· 52 52 config LEDS_MT6360 53 53 tristate "LED Support for Mediatek MT6360 PMIC" 54 54 depends on LEDS_CLASS && OF 55 - depends on LEDS_CLASS_FLASH || !LEDS_CLASS_FLASH 56 - depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR 55 + depends on LEDS_CLASS_FLASH 56 + depends on LEDS_CLASS_MULTICOLOR 57 57 depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS 58 58 depends on MFD_MT6360 59 59 help
+1 -1
drivers/staging/greybus/Kconfig
··· 64 64 65 65 config GREYBUS_LIGHT 66 66 tristate "Greybus LED Class driver" 67 - depends on LEDS_CLASS 67 + depends on LEDS_CLASS_FLASH 68 68 help 69 69 Select this option if you have a device that follows the 70 70 Greybus LED Class specification.
-21
drivers/staging/greybus/light.c
··· 29 29 struct attribute_group *attr_group; 30 30 const struct attribute_group **attr_groups; 31 31 struct led_classdev *led; 32 - #if IS_REACHABLE(CONFIG_LEDS_CLASS_FLASH) 33 32 struct led_classdev_flash fled; 34 33 struct led_flash_setting intensity_uA; 35 34 struct led_flash_setting timeout_us; 36 - #else 37 - struct led_classdev cled; 38 - #endif 39 35 struct gb_light *light; 40 36 bool is_registered; 41 37 bool releasing; ··· 80 84 | GB_CHANNEL_MODE_INDICATOR)); 81 85 } 82 86 83 - #if IS_REACHABLE(CONFIG_LEDS_CLASS_FLASH) 84 87 static struct gb_channel *get_channel_from_cdev(struct led_classdev *cdev) 85 88 { 86 89 struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(cdev); ··· 148 153 149 154 return __gb_lights_flash_intensity_set(channel, intensity); 150 155 } 151 - #else 152 - static struct gb_channel *get_channel_from_cdev(struct led_classdev *cdev) 153 - { 154 - return container_of(cdev, struct gb_channel, cled); 155 - } 156 - 157 - static struct led_classdev *get_channel_cdev(struct gb_channel *channel) 158 - { 159 - return &channel->cled; 160 - } 161 - 162 - static int __gb_lights_flash_brightness_set(struct gb_channel *channel) 163 - { 164 - return 0; 165 - } 166 - #endif 167 156 168 157 static int gb_lights_color_set(struct gb_channel *channel, u32 color); 169 158 static int gb_lights_fade_set(struct gb_channel *channel);
-24
include/linux/led-class-flash.h
··· 85 85 return container_of(lcdev, struct led_classdev_flash, led_cdev); 86 86 } 87 87 88 - #if IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) 89 88 /** 90 89 * led_classdev_flash_register_ext - register a new object of LED class with 91 90 * init data and with support for flash LEDs ··· 114 115 115 116 void devm_led_classdev_flash_unregister(struct device *parent, 116 117 struct led_classdev_flash *fled_cdev); 117 - 118 - #else 119 - 120 - static inline int led_classdev_flash_register_ext(struct device *parent, 121 - struct led_classdev_flash *fled_cdev, 122 - struct led_init_data *init_data) 123 - { 124 - return 0; 125 - } 126 - 127 - static inline void led_classdev_flash_unregister(struct led_classdev_flash *fled_cdev) {}; 128 - static inline int devm_led_classdev_flash_register_ext(struct device *parent, 129 - struct led_classdev_flash *fled_cdev, 130 - struct led_init_data *init_data) 131 - { 132 - return 0; 133 - } 134 - 135 - static inline void devm_led_classdev_flash_unregister(struct device *parent, 136 - struct led_classdev_flash *fled_cdev) 137 - {}; 138 - 139 - #endif /* IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) */ 140 118 141 119 static inline int led_classdev_flash_register(struct device *parent, 142 120 struct led_classdev_flash *fled_cdev)
-29
include/linux/led-class-multicolor.h
··· 30 30 return container_of(led_cdev, struct led_classdev_mc, led_cdev); 31 31 } 32 32 33 - #if IS_ENABLED(CONFIG_LEDS_CLASS_MULTICOLOR) 34 33 /** 35 34 * led_classdev_multicolor_register_ext - register a new object of led_classdev 36 35 * class with support for multicolor LEDs ··· 63 64 64 65 void devm_led_classdev_multicolor_unregister(struct device *parent, 65 66 struct led_classdev_mc *mcled_cdev); 66 - #else 67 - 68 - static inline int led_classdev_multicolor_register_ext(struct device *parent, 69 - struct led_classdev_mc *mcled_cdev, 70 - struct led_init_data *init_data) 71 - { 72 - return 0; 73 - } 74 - 75 - static inline void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev) {}; 76 - static inline int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev, 77 - enum led_brightness brightness) 78 - { 79 - return 0; 80 - } 81 - 82 - static inline int devm_led_classdev_multicolor_register_ext(struct device *parent, 83 - struct led_classdev_mc *mcled_cdev, 84 - struct led_init_data *init_data) 85 - { 86 - return 0; 87 - } 88 - 89 - static inline void devm_led_classdev_multicolor_unregister(struct device *parent, 90 - struct led_classdev_mc *mcled_cdev) 91 - {}; 92 - 93 - #endif /* IS_ENABLED(CONFIG_LEDS_CLASS_MULTICOLOR) */ 94 67 95 68 static inline int led_classdev_multicolor_register(struct device *parent, 96 69 struct led_classdev_mc *mcled_cdev)