summaryrefslogtreecommitdiffstats
path: root/drivers/leds/led-core.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2016-01-22 21:43:48 +0100
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-03-14 09:22:20 +0100
commitd84d80f38f0ff4eb4becf1a3569c8e7b2c463b61 (patch)
tree6a856df3aff0c9611a666faca10079960a1480f2 /drivers/leds/led-core.c
parentleds: core: fix misleading comment after workqueue removal from drivers (diff)
downloadlinux-d84d80f38f0ff4eb4becf1a3569c8e7b2c463b61.tar.xz
linux-d84d80f38f0ff4eb4becf1a3569c8e7b2c463b61.zip
leds: core: avoid error message when a USB LED device is unplugged
When a USB LED device is unplugged the remove call chain calls led_classdev_unregister which tries to switch the LED off. As the device has been removed already this results in a ENODEV error message in dmesg. Avoid this error message by ignoring ENODEV in calls from led_classdev_unregister if the LED device is flagged as pluggable. Therefore a new flag LED_HW_PLUGGABLE was introduced which should be set by all LED drivers handling pluggable LED devices (mainly USB LED devices). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds/led-core.c')
-rw-r--r--drivers/leds/led-core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 19e1e60dfaa3..ad684b6d0b72 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -98,7 +98,10 @@ static void set_brightness_delayed(struct work_struct *ws)
led_cdev->delayed_set_value);
else
ret = -ENOTSUPP;
- if (ret < 0)
+ if (ret < 0 &&
+ /* LED HW might have been unplugged, therefore don't warn */
+ !(ret == -ENODEV && (led_cdev->flags & LED_UNREGISTERING) &&
+ (led_cdev->flags & LED_HW_PLUGGABLE)))
dev_err(led_cdev->dev,
"Setting an LED's brightness failed (%d)\n", ret);
}