From: Qingtao Cao <qingtao.cao.au@gmail.com>
To: u.kleine-koenig@pengutronix.de
Cc: Qingtao Cao <qingtao.cao@digi.com>, Pavel Machek <pavel@ucw.cz>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] leds: ledtrig-tty.c: call led_set_brightness() when the blocking callback is not available
Date: Fri, 9 Dec 2022 10:10:38 +1000 [thread overview]
Message-ID: <20221209001039.7287-1-qingtao.cao@digi.com> (raw)
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@digi.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
next reply other threads:[~2022-12-09 0:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 0:10 Qingtao Cao [this message]
2022-12-09 12:40 ` Uwe Kleine-König
2023-01-04 16:20 ` Lee Jones
2023-01-07 18:34 ` Jacek Anaszewski
2023-01-20 13:27 ` Lee Jones
2023-01-22 22:18 ` Jacek Anaszewski
2023-01-23 9:01 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221209001039.7287-1-qingtao.cao@digi.com \
--to=qingtao.cao.au@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=qingtao.cao@digi.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®