]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
leds: multicolor: Use led_get_color_name() function
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 13 Jun 2024 14:48:37 +0000 (16:48 +0200)
committerLee Jones <lee@kernel.org>
Fri, 21 Jun 2024 10:41:36 +0000 (11:41 +0100)
led_get_color_name() is a safer alternative to led_colors.

led-class-multicolor.c is the only external user of led_colors and its
removal allows unexporting the array.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20240613-cros_ec-led-v3-2-500b50f41e0f@weissschuh.net
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/led-class-multicolor.c

index ec62a48116135c5cf8069bfdbd4aa23aa9dcca39..584e3786a1e7825e54c8f3fbfe7144897dc8739c 100644 (file)
@@ -101,7 +101,7 @@ static ssize_t multi_index_show(struct device *dev,
 
        for (i = 0; i < mcled_cdev->num_colors; i++) {
                index = mcled_cdev->subled_info[i].color_index;
-               len += sprintf(buf + len, "%s", led_colors[index]);
+               len += sprintf(buf + len, "%s", led_get_color_name(index));
                if (i < mcled_cdev->num_colors - 1)
                        len += sprintf(buf + len, " ");
        }