Skip to content

Commit

Permalink
leds: class: Don't expose color sysfs entry
Browse files Browse the repository at this point in the history
The commit c7d8005 ("leds: class: Store the color index in struct
led_classdev") introduced a new sysfs entry "color" that is commonly
created for the led classdev.  Unfortunately, this conflicts with the
"color" sysfs entry of already existing drivers such as Logitech HID
or System76 ACPI drivers.  The driver probe fails due to the conflict,
hence it leads to a severe regression with the missing keyboard, for
example.

This patch reverts partially the change in the commit above for
removing the led class color sysfs entries again for addressing the
regressions.  The newly introduced led_classdev.color field is kept as
it's already used by other driver.

Fixes: c7d8005 ("leds: class: Store the color index in struct led_classdev")
Reported-by: Johannes Penßel <johannes.penssel@gmail.com>
Closes: https://lore.kernel.org/r/b5646db3-acff-45aa-baef-df3f660486fb@gmail.com
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218045
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218155
Link: https://bugzilla.suse.com/show_bug.cgi?id=1217172
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20231121162359.9332-1-tiwai@suse.de
Signed-off-by: Lee Jones <lee@kernel.org>
  • Loading branch information
Takashi Iwai authored and Lee Jones committed Nov 22, 2023
1 parent b85ea95 commit 8f2244c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
9 changes: 0 additions & 9 deletions Documentation/ABI/testing/sysfs-class-led
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ Description:
brightness. Reading this file when no hw brightness change
event has happened will return an ENODATA error.

What: /sys/class/leds/<led>/color
Date: June 2023
KernelVersion: 6.5
Description:
Color of the LED.

This is a read-only file. Reading this file returns the color
of the LED as a string (e.g: "red", "green", "multicolor").

What: /sys/class/leds/<led>/trigger
Date: March 2006
KernelVersion: 2.6.17
Expand Down
14 changes: 0 additions & 14 deletions drivers/leds/led-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,6 @@ static ssize_t max_brightness_show(struct device *dev,
}
static DEVICE_ATTR_RO(max_brightness);

static ssize_t color_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
const char *color_text = "invalid";
struct led_classdev *led_cdev = dev_get_drvdata(dev);

if (led_cdev->color < LED_COLOR_ID_MAX)
color_text = led_colors[led_cdev->color];

return sysfs_emit(buf, "%s\n", color_text);
}
static DEVICE_ATTR_RO(color);

#ifdef CONFIG_LEDS_TRIGGERS
static BIN_ATTR(trigger, 0644, led_trigger_read, led_trigger_write, 0);
static struct bin_attribute *led_trigger_bin_attrs[] = {
Expand All @@ -102,7 +89,6 @@ static const struct attribute_group led_trigger_group = {
static struct attribute *led_class_attrs[] = {
&dev_attr_brightness.attr,
&dev_attr_max_brightness.attr,
&dev_attr_color.attr,
NULL,
};

Expand Down

0 comments on commit 8f2244c

Please sign in to comment.