diff mbox series

[1/3] HID: elan: Silence mute LED errors being logged when the device is unplugged

Message ID 20210220163211.323178-1-hdegoede@redhat.com
State Superseded
Headers show
Series [1/3] HID: elan: Silence mute LED errors being logged when the device is unplugged | expand

Commit Message

Hans de Goede Feb. 20, 2021, 4:32 p.m. UTC
Being integrated into an USB keyboard-dock the mute LED can go away
at any time, leading to the following errors:

[  918.667671] elan 0003:04F3:0755.0002: Failed to set mute led brightness: -19
[  918.667737] leds elan:red:mute: Setting an LED's brightness failed (-19)

Fix this by making the following changes:

1. Don't log an error from elan_mute_led_set_brigtness() when ret == ENODEV
2. Set the LED_HW_PLUGGABLE flag on the mute LED led_classdev

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/hid-elan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Marek Behún Feb. 21, 2021, 1:45 a.m. UTC | #1
Again I would use
  ... Set default_triggers for ...

Reviewed-by: Marek Behún <kabel@kernel.org>
Marek Behún Feb. 21, 2021, 1:46 a.m. UTC | #2
On Sat, 20 Feb 2021 17:32:09 +0100
Hans de Goede <hdegoede@redhat.com> wrote:

> 1. Don't log an error from elan_mute_led_set_brigtness() when ret == ENODEV

ret == -ENODEV

Otherwise
Reviewed-by: Marek Behún <kabel@kernel.org>
diff mbox series

Patch

diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c
index dae193749d44..71740988a3f6 100644
--- a/drivers/hid/hid-elan.c
+++ b/drivers/hid/hid-elan.c
@@ -445,7 +445,8 @@  static int elan_mute_led_set_brigtness(struct led_classdev *led_cdev,
 	kfree(dmabuf);
 
 	if (ret != ELAN_LED_REPORT_SIZE) {
-		hid_err(hdev, "Failed to set mute led brightness: %d\n", ret);
+		if (ret != -ENODEV)
+			hid_err(hdev, "Failed to set mute led brightness: %d\n", ret);
 		return ret;
 	}
 
@@ -462,6 +463,7 @@  static int elan_init_mute_led(struct hid_device *hdev)
 	mute_led->brightness_get = elan_mute_led_get_brigtness;
 	mute_led->brightness_set_blocking = elan_mute_led_set_brigtness;
 	mute_led->max_brightness = LED_ON;
+	mute_led->flags = LED_HW_PLUGGABLE;
 	mute_led->dev = &hdev->dev;
 
 	return devm_led_classdev_register(&hdev->dev, mute_led);