linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Juergen Borleis <jbe@pengutronix.de>,
	linux-leds@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] leds: trigger/tty: Use led_set_brightness() to support all use cases
Date: Fri, 23 Feb 2024 14:22:18 +0000	[thread overview]
Message-ID: <20240223142218.GA1666215@google.com> (raw)
In-Reply-To: <20230109084320.nj7erwh3eu4jlw7y@pengutronix.de>

On Mon, 09 Jan 2023, Uwe Kleine-König wrote:

> Hello Jürgen,
> 
> On Mon, May 03, 2021 at 11:25:42AM +0200, Juergen Borleis wrote:
> > Using led_set_brightness_sync() only works for LEDs which are connected
> > via some kind of external bus like I²C or SPI. But it doesn't work for
> > the simple use case of directly connected LEDs via GPIOs.
> > Because this function only honors the led_classdev::brightness_set_blocking
> > callback. But the LED-GPIO driver registers the
> > led_classdev::brightness_set member if the GPIO can be modified directly
> > and thus, TTY triggers fail silently with -ENOTSUPP.
> > 
> > With the previously used led_set_brightness() it works for both use cases.
> > This function first checks for the simple case where the GPIO can be changed
> > without additional overhead, and if it fails, does the modification via a
> > workqueue.
> > 
> > Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
> > ---
> >  drivers/leds/trigger/ledtrig-tty.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/leds/trigger/ledtrig-tty.c b/drivers/leds/trigger/ledtrig-tty.c
> > index f62db7e..af61281 100644
> > --- a/drivers/leds/trigger/ledtrig-tty.c
> > +++ b/drivers/leds/trigger/ledtrig-tty.c
> > @@ -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(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(trigger_data->led_cdev, LED_OFF);
> >  	}
> 
> This problem still exists, right?
> 
> I think the right thing here is to call led_set_brightness_nosleep()
> however.
> 
> Having said that, I think there are too many variants of
> led_set_brightness which makes it difficult to pick the right one.
> 
> (I'm aware of
>  - led_set_brightness_nosleep
>  - led_set_brightness_nopm
>  - led_set_brightness_sync
>  - led_set_brightness
> 
> and there are a few more static variants in led-core.c
> (__led_set_brightness, __led_set_brightness_blocking,
> set_brightness_delayed).)

This patch (and this response) was never sent to me.

Not a great deal I can do if I'm not aware of it.

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2024-02-23 14:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03  9:25 [PATCH] leds: trigger/tty: Use led_set_brightness() to support all use cases Juergen Borleis
2021-05-03 10:16 ` Pavel Machek
2023-01-09  8:43 ` Uwe Kleine-König
2024-02-23 14:22   ` Lee Jones [this message]
2024-02-23 14:24     ` 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=20240223142218.GA1666215@google.com \
    --to=lee@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jbe@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --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;
as well as URLs for NNTP newsgroup(s).