From: Fenglin Wu <fenglinw@xxxxxxxxxxxxxx> The LED_KEEP_TRIGGER flag prevents the trigger being removed while turning off the LEDs. Extend the flag usage to prevent the trigger being removed even while "none" trigger is set. Signed-off-by: Fenglin Wu <fenglinw@xxxxxxxxxxxxxx> Signed-off-by: Guru Das Srinagesh <gurus@xxxxxxxxxxxxxx> --- drivers/leds/led-triggers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 8d11a5e..a0e4531 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -40,7 +40,8 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, goto unlock; } - if (sysfs_streq(buf, "none")) { + if (sysfs_streq(buf, "none") && + !(led_cdev->flags & LED_KEEP_TRIGGER)) { led_trigger_remove(led_cdev); goto unlock; } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project