From d84d80f38f0ff4eb4becf1a3569c8e7b2c463b61 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Fri, 22 Jan 2016 21:43:48 +0100 Subject: 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 Signed-off-by: Jacek Anaszewski --- drivers/leds/led-class.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/leds/led-class.c') diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 14139c337312..aa84e5b37593 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -245,6 +245,8 @@ void led_classdev_unregister(struct led_classdev *led_cdev) up_write(&led_cdev->trigger_lock); #endif + led_cdev->flags |= LED_UNREGISTERING; + /* Stop blinking */ led_stop_software_blink(led_cdev); -- cgit v1.2.3-59-g8ed1b