linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] leds: trigger/tty: Use led_set_brightness_nosleep() to set brightness
@ 2023-04-14 16:48 Uwe Kleine-König
  2023-04-16 15:13 ` Jacek Anaszewski
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2023-04-14 16:48 UTC (permalink / raw)
  To: Pavel Machek, Lee Jones; +Cc: linux-leds, Jacek Anaszewski, Florian Eckert

After commit ba8a86e4dadb ("leds: trigger/tty: Use
led_set_brightness_sync() from workqueue") this is the second try to
pick the right function to set the LED brightness from a trigger.

led_set_brightness_sync() has the problem that it doesn't work for LEDs
without a .brightness_set_blocking() callback. This is (among others)
the case for LEDs connected to non-sleeping GPIOs.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

after a few (non-public and public) reports that the tty trigger doesn't
work and Jacek pointed out in
https://lore.kernel.org/all/ad4a1069-72c6-a431-336f-ed78a57a1ba0@gmail.com/#t
that led_set_brightness_nosleep() is the right function, here comes a
patch to actually implement that.

Does this justify a Fixes line? In that case that would be:

	Fixes: ba8a86e4dadb ("leds: trigger/tty: Use led_set_brightness_sync() from workqueue")

(As ba8a86e4dadb declares to be a fix for fd4a641ac88f ("leds: trigger:
implement a tty trigger") I think a further reference to fd4a641ac88f
isn't necesary.)

Best regards
Uwe

 drivers/leds/trigger/ledtrig-tty.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/trigger/ledtrig-tty.c b/drivers/leds/trigger/ledtrig-tty.c
index f62db7e520b5..c8bbdeac93b9 100644
--- a/drivers/leds/trigger/ledtrig-tty.c
+++ b/drivers/leds/trigger/ledtrig-tty.c
@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0
 
 #include <linux/delay.h>
-#include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/tty.h>
 #include <uapi/linux/serial.h>
+#include "../leds.h"
 
 struct ledtrig_tty_data {
 	struct led_classdev *led_cdev;
@@ -122,12 +122,12 @@ static void ledtrig_tty_work(struct work_struct *work)
 
 	if (icount.rx != trigger_data->rx ||
 	    icount.tx != trigger_data->tx) {
-		led_set_brightness_sync(trigger_data->led_cdev, LED_ON);
+		led_set_brightness_nosleep(trigger_data->led_cdev, LED_ON);
 
 		trigger_data->rx = icount.rx;
 		trigger_data->tx = icount.tx;
 	} else {
-		led_set_brightness_sync(trigger_data->led_cdev, LED_OFF);
+		led_set_brightness_nosleep(trigger_data->led_cdev, LED_OFF);
 	}
 
 out:

base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-04-18 18:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-14 16:48 [PATCH] leds: trigger/tty: Use led_set_brightness_nosleep() to set brightness Uwe Kleine-König
2023-04-16 15:13 ` Jacek Anaszewski
2023-04-17  7:18 ` Florian Eckert
2023-04-17 12:28 ` Pavel Machek
2023-04-17 12:44   ` Uwe Kleine-König
2023-04-17 18:33     ` Jacek Anaszewski
2023-04-17 19:17       ` Uwe Kleine-König
2023-04-17 19:51         ` Jacek Anaszewski
2023-04-17 22:27           ` Uwe Kleine-König
2023-04-18 18:02             ` Jacek Anaszewski
2023-04-18 18:04               ` Jacek Anaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).