[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210601005155.27997-7-kabel@kernel.org>
Date: Tue, 1 Jun 2021 02:51:51 +0200
From: Marek Behún <kabel@...nel.org>
To: linux-leds@...r.kernel.org
Cc: netdev@...r.kernel.org, Pavel Machek <pavel@....cz>,
Dan Murphy <dmurphy@...com>,
Russell King <linux@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>,
Matthias Schiffer <matthias.schiffer@...tq-group.com>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Marek Behún <kabel@...nel.org>
Subject: [PATCH leds v2 06/10] leds: core: inform trigger that it's deactivation is due to LED removal
Move setting of the LED_UNREGISTERING before deactivating the trigger in
led_classdev_unregister().
It can be useful for a LED trigger to know whether it is being
deactivated due to the LED being unregistered. This makes it possible
for LED drivers which implement trigger offloading to leave the LED in
HW triggering mode when the LED is unregistered, instead of disabling
it.
Signed-off-by: Marek Behún <kabel@...nel.org>
---
drivers/leds/led-class.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 2e495ff67856..0486129a7f31 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -436,6 +436,8 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
if (IS_ERR_OR_NULL(led_cdev->dev))
return;
+ led_cdev->flags |= LED_UNREGISTERING;
+
#ifdef CONFIG_LEDS_TRIGGERS
down_write(&led_cdev->trigger_lock);
if (led_cdev->trigger)
@@ -443,8 +445,6 @@ 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);
--
2.26.3
Powered by blists - more mailing lists