leds: Make flash and multicolor dependencies unconditional
authorArnd Bergmann <arnd@arndb.de>
Tue, 9 Jan 2024 09:06:40 +0000 (10:06 +0100)
committerLee Jones <lee@kernel.org>
Thu, 7 Mar 2024 08:48:03 +0000 (08:48 +0000)
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>
drivers/leds/Kconfig
drivers/leds/flash/Kconfig
drivers/staging/greybus/Kconfig
drivers/staging/greybus/light.c
include/linux/led-class-flash.h
include/linux/led-class-multicolor.h

index 64bb2de237e950ceefb63bc7dd9e3a0a963ffbe0..52328d295b4ece0f8f78a55723110b43f14ec59b 100644 (file)
@@ -399,7 +399,7 @@ config LEDS_LP3952
 config LEDS_LP50XX
        tristate "LED Support for TI LP5036/30/24/18/12/09 LED driver chip"
        depends on LEDS_CLASS && REGMAP_I2C
-       depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR
+       depends on LEDS_CLASS_MULTICOLOR
        help
          If you say yes here you get support for the Texas Instruments
          LP5036, LP5030, LP5024, LP5018, LP5012 and LP5009 LED driver.
@@ -410,7 +410,7 @@ config LEDS_LP50XX
 config LEDS_LP55XX_COMMON
        tristate "Common Driver for TI/National LP5521/5523/55231/5562/8501"
        depends on LEDS_CLASS
-       depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR
+       depends on LEDS_CLASS_MULTICOLOR
        depends on OF
        depends on I2C
        select FW_LOADER
index 24722d581369969eb96e9f354733ffa4d9d0dfbf..809b6d98bb3e6e3c8059195a958498d2c5989df3 100644 (file)
@@ -52,8 +52,8 @@ config LEDS_MAX77693
 config LEDS_MT6360
        tristate "LED Support for Mediatek MT6360 PMIC"
        depends on LEDS_CLASS && OF
-       depends on LEDS_CLASS_FLASH || !LEDS_CLASS_FLASH
-       depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR
+       depends on LEDS_CLASS_FLASH
+       depends on LEDS_CLASS_MULTICOLOR
        depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
        depends on MFD_MT6360
        help
index 927cfa4bc9898cddaa56242003c5ca1448325faa..1e745a8d439c89a7f5139f263d38bdf97dc5d43c 100644 (file)
@@ -64,7 +64,7 @@ config GREYBUS_HID
 
 config GREYBUS_LIGHT
        tristate "Greybus LED Class driver"
-       depends on LEDS_CLASS
+       depends on LEDS_CLASS_FLASH
        help
          Select this option if you have a device that follows the
          Greybus LED Class specification.
index 87d36948c610675bc09f01542930eb5f98f7acd4..d62f97249aca678886f064d4b8f7cf3304f6afa2 100644 (file)
@@ -29,13 +29,9 @@ struct gb_channel {
        struct attribute_group          *attr_group;
        const struct attribute_group    **attr_groups;
        struct led_classdev             *led;
-#if IS_REACHABLE(CONFIG_LEDS_CLASS_FLASH)
        struct led_classdev_flash       fled;
        struct led_flash_setting        intensity_uA;
        struct led_flash_setting        timeout_us;
-#else
-       struct led_classdev             cled;
-#endif
        struct gb_light                 *light;
        bool                            is_registered;
        bool                            releasing;
@@ -84,7 +80,6 @@ static bool is_channel_flash(struct gb_channel *channel)
                                   | GB_CHANNEL_MODE_INDICATOR));
 }
 
-#if IS_REACHABLE(CONFIG_LEDS_CLASS_FLASH)
 static struct gb_channel *get_channel_from_cdev(struct led_classdev *cdev)
 {
        struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(cdev);
@@ -153,22 +148,6 @@ static int __gb_lights_flash_brightness_set(struct gb_channel *channel)
 
        return __gb_lights_flash_intensity_set(channel, intensity);
 }
-#else
-static struct gb_channel *get_channel_from_cdev(struct led_classdev *cdev)
-{
-       return container_of(cdev, struct gb_channel, cled);
-}
-
-static struct led_classdev *get_channel_cdev(struct gb_channel *channel)
-{
-       return &channel->cled;
-}
-
-static int __gb_lights_flash_brightness_set(struct gb_channel *channel)
-{
-       return 0;
-}
-#endif
 
 static int gb_lights_color_set(struct gb_channel *channel, u32 color);
 static int gb_lights_fade_set(struct gb_channel *channel);
index 612b4cab3819ecc6e64e1ce23d2ca8e811b44042..36df927ec4b7dcaf9074c6ef32ac8ce83a87a79d 100644 (file)
@@ -85,7 +85,6 @@ static inline struct led_classdev_flash *lcdev_to_flcdev(
        return container_of(lcdev, struct led_classdev_flash, led_cdev);
 }
 
-#if IS_ENABLED(CONFIG_LEDS_CLASS_FLASH)
 /**
  * led_classdev_flash_register_ext - register a new object of LED class with
  *                                  init data and with support for flash LEDs
@@ -116,29 +115,6 @@ int devm_led_classdev_flash_register_ext(struct device *parent,
 void devm_led_classdev_flash_unregister(struct device *parent,
                                        struct led_classdev_flash *fled_cdev);
 
-#else
-
-static inline int led_classdev_flash_register_ext(struct device *parent,
-                                   struct led_classdev_flash *fled_cdev,
-                                   struct led_init_data *init_data)
-{
-       return 0;
-}
-
-static inline void led_classdev_flash_unregister(struct led_classdev_flash *fled_cdev) {};
-static inline int devm_led_classdev_flash_register_ext(struct device *parent,
-                                    struct led_classdev_flash *fled_cdev,
-                                    struct led_init_data *init_data)
-{
-       return 0;
-}
-
-static inline void devm_led_classdev_flash_unregister(struct device *parent,
-                                       struct led_classdev_flash *fled_cdev)
-{};
-
-#endif  /* IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) */
-
 static inline int led_classdev_flash_register(struct device *parent,
                                           struct led_classdev_flash *fled_cdev)
 {
index 210d57bcd767aa33b68e4cddbfb7069e5d03ed50..db9f34c6736e9ae0f9ff821bf0162630d3b5ab8a 100644 (file)
@@ -30,7 +30,6 @@ static inline struct led_classdev_mc *lcdev_to_mccdev(
        return container_of(led_cdev, struct led_classdev_mc, led_cdev);
 }
 
-#if IS_ENABLED(CONFIG_LEDS_CLASS_MULTICOLOR)
 /**
  * led_classdev_multicolor_register_ext - register a new object of led_classdev
  *                                   class with support for multicolor LEDs
@@ -64,34 +63,6 @@ int devm_led_classdev_multicolor_register_ext(struct device *parent,
 
 void devm_led_classdev_multicolor_unregister(struct device *parent,
                                            struct led_classdev_mc *mcled_cdev);
-#else
-
-static inline int led_classdev_multicolor_register_ext(struct device *parent,
-                                           struct led_classdev_mc *mcled_cdev,
-                                           struct led_init_data *init_data)
-{
-       return 0;
-}
-
-static inline void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev) {};
-static inline int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,
-                                              enum led_brightness brightness)
-{
-       return 0;
-}
-
-static inline int devm_led_classdev_multicolor_register_ext(struct device *parent,
-                                         struct led_classdev_mc *mcled_cdev,
-                                         struct led_init_data *init_data)
-{
-       return 0;
-}
-
-static inline void devm_led_classdev_multicolor_unregister(struct device *parent,
-                                           struct led_classdev_mc *mcled_cdev)
-{};
-
-#endif  /* IS_ENABLED(CONFIG_LEDS_CLASS_MULTICOLOR) */
 
 static inline int led_classdev_multicolor_register(struct device *parent,
                                            struct led_classdev_mc *mcled_cdev)