leds: trigger/tty: Use led_set_brightness_sync() from workqueue

led_set_brightness() involves scheduling a workqueue. As here the led's
brightness setting is done in context of the trigger's workqueue this is
unjustified overhead and it's more sensible to use
led_set_brightness_sync().

Fixes: fd4a641ac8 ("leds: trigger: implement a tty trigger")
Reported-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20210219133307.4840-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Uwe Kleine-König 2021-02-19 14:33:07 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель 1487e7bae8
Коммит ba8a86e4da
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -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(trigger_data->led_cdev, LED_ON);
led_set_brightness_sync(trigger_data->led_cdev, LED_ON);
trigger_data->rx = icount.rx;
trigger_data->tx = icount.tx;
} else {
led_set_brightness(trigger_data->led_cdev, LED_OFF);
led_set_brightness_sync(trigger_data->led_cdev, LED_OFF);
}
out: