[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221209001039.7287-1-qingtao.cao@digi.com>
Date: Fri, 9 Dec 2022 10:10:38 +1000
From: Qingtao Cao <qingtao.cao.au@...il.com>
To: u.kleine-koenig@...gutronix.de
Cc: Qingtao Cao <qingtao.cao@...i.com>, Pavel Machek <pavel@....cz>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] leds: ledtrig-tty.c: call led_set_brightness() when the blocking callback is not available
The Marvell GPIO controller's driver will setup its struct gpio_chip's can_sleep
false, making create_gpio_led() setting up the brightness_set function pointer
instead of the brightness_set_blocking function pointer. In this case the
nonblocking version led_set_brightness() should be fallen back on by ledtrig_tty_work()
Signed-off-by: Qingtao Cao <qingtao.cao@...i.com>
---
drivers/leds/trigger/ledtrig-tty.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/trigger/ledtrig-tty.c b/drivers/leds/trigger/ledtrig-tty.c
index f62db7e520b5..e43d285b5d06 100644
--- a/drivers/leds/trigger/ledtrig-tty.c
+++ b/drivers/leds/trigger/ledtrig-tty.c
@@ -122,12 +122,18 @@ 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);
+ if (trigger_data->led_cdev->brightness_set_blocking)
+ led_set_brightness_sync(trigger_data->led_cdev, LED_ON);
+ else if (trigger_data->led_cdev->brightness_set)
+ led_set_brightness(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);
+ if (trigger_data->led_cdev->brightness_set_blocking)
+ led_set_brightness_sync(trigger_data->led_cdev, LED_OFF);
+ else if (trigger_data->led_cdev->brightness_set)
+ led_set_brightness(trigger_data->led_cdev, LED_OFF);
}
out:
--
2.34.1
Powered by blists - more mailing lists