aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorThomas Weißschuh <[email protected]>2024-06-13 16:48:36 +0200
committerLee Jones <[email protected]>2024-06-21 11:41:32 +0100
commit5f2e950755c76c6fc20fc4ebd8355671fbbd7ac0 (patch)
tree73568d7e89fcc9439fbf2c7dc808df148245dd48 /include/linux
parent1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0 (diff)
leds: core: Introduce led_get_color_name() function
This is similar to the existing led_colors[] array but is safer to use and usable by everyone. Getting string representations of color ids is useful for drivers which are handling color IDs anyways, for example for the multicolor API. Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/leds.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 6300313c46b7..dedea965afbf 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -428,6 +428,16 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data,
char *led_classdev_name);
/**
+ * led_get_color_name - get string representation of color ID
+ * @color_id: The LED_COLOR_ID_* constant
+ *
+ * Get the string name of a LED_COLOR_ID_* constant.
+ *
+ * Returns: A string constant or NULL on an invalid ID.
+ */
+const char *led_get_color_name(u8 color_id);
+
+/**
* led_sysfs_is_disabled - check if LED sysfs interface is disabled
* @led_cdev: the LED to query
*