[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230510162234.291439-5-hdegoede@redhat.com>
Date: Wed, 10 May 2023 18:22:34 +0200
From: Hans de Goede <hdegoede@...hat.com>
To: Pavel Machek <pavel@....cz>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Lee Jones <lee@...nel.org>,
Sebastian Reichel <sre@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Michael Grzeschik <m.grzeschik@...gutronix.de>,
Johannes Berg <johannes@...solutions.net>,
Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>
Cc: Hans de Goede <hdegoede@...hat.com>,
linux-leds@...r.kernel.org,
linux-pm@...r.kernel.org,
linux-usb@...r.kernel.org,
netdev@...r.kernel.org,
netfilter-devel@...r.kernel.org,
coreteam@...filter.org,
Yauhen Kharuzhy <jekhor@...il.com>
Subject: [PATCH RESEND 4/4] leds: Clear LED_INIT_DEFAULT_TRIGGER when clearing current trigger
Not all triggers use LED_INIT_DEFAULT_TRIGGER, which means that it
will not get cleared when the default trigger is a trigger which
does not use it such as "default-on".
If the default trigger then later gets replaced by a trigger which
does check LED_INIT_DEFAULT_TRIGGER, such as "timer" then that trigger
will behave as if it is the default trigger which it should not do.
To fix this clear the LED_INIT_DEFAULT_TRIGGER flag when clearing
the current trigger, so that it will not be set for any subsequently
set (non default) triggers.
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@...il.com>
Tested-by: Yauhen Kharuzhy <jekhor@...il.com>
Signed-off-by: Hans de Goede <hdegoede@...hat.com>
---
drivers/leds/led-triggers.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 8214d3f7bc5f..6a5e1f41f9a4 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -185,6 +185,7 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
led_cdev->trigger = NULL;
led_cdev->trigger_data = NULL;
led_cdev->activated = false;
+ led_cdev->flags &= ~LED_INIT_DEFAULT_TRIGGER;
led_set_brightness(led_cdev, LED_OFF);
}
if (trig) {
--
2.40.1
Powered by blists - more mailing lists