Linux LED subsystem development
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Craig McQueen <craig@mcqueen.au>
Cc: linux-leds@vger.kernel.org
Subject: Re: [PATCH] led-triggers: accept "default" written to sysfs trigger attr
Date: Thu, 6 Mar 2025 15:32:32 -0800	[thread overview]
Message-ID: <20250306233232.GC8350@google.com> (raw)
In-Reply-To: <20250306225524.318562-1-craig@mcqueen.au>

On Fri, 07 Mar 2025, Craig McQueen wrote:

> If the text "default" is written to the LED's sysfs 'trigger' attr, then
> call led_trigger_set_default() to set the LED to its default trigger.

More info please.

Please explain why this is useful.

Under what circumstances would the default trigger not be set?

> ---
>  drivers/leds/led-triggers.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
> index b2d40f87a5ff..f2bc3bb5062d 100644
> --- a/drivers/leds/led-triggers.c
> +++ b/drivers/leds/led-triggers.c
> @@ -54,6 +54,11 @@ ssize_t led_trigger_write(struct file *filp, struct kobject *kobj,
>  		goto unlock;
>  	}
>  
> +	if (sysfs_streq(buf, "default")) {
> +		led_trigger_set_default(led_cdev);
> +		goto unlock;
> +	}
> +
>  	down_read(&triggers_list_lock);
>  	list_for_each_entry(trig, &trigger_list, next_trig) {
>  		if (sysfs_streq(buf, trig->name) && trigger_relevant(led_cdev, trig)) {
> -- 
> 2.48.1
> 
> 

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2025-03-06 23:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 22:55 [PATCH] led-triggers: accept "default" written to sysfs trigger attr Craig McQueen
2025-03-06 23:32 ` Lee Jones [this message]
2025-03-07  1:42   ` Craig McQueen
2025-03-07 16:50 ` Jacek Anaszewski
2025-03-07 17:10   ` Jacek Anaszewski
2025-03-09 11:33     ` Craig McQueen
2025-03-09 18:50       ` Jacek Anaszewski
2025-03-10 20:18         ` Jacek Anaszewski
2025-03-11 10:27         ` Craig McQueen
2025-03-11 19:22           ` Jacek Anaszewski
2025-03-14 11:11 ` 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=20250306233232.GC8350@google.com \
    --to=lee@kernel.org \
    --cc=craig@mcqueen.au \
    --cc=linux-leds@vger.kernel.org \
    /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