* [PATCH] led-triggers: allow writing 'default' to sysfs trigger attr
@ 2017-11-28 6:38 Craig McQueen
2017-11-28 12:07 ` Pavel Machek
0 siblings, 1 reply; 4+ messages in thread
From: Craig McQueen @ 2017-11-28 6:38 UTC (permalink / raw)
To: linux-leds; +Cc: Craig McQueen
It calls led_trigger_set_default() to set the LED to its default
trigger.
---
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 431123b048a2..f090a7806017 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -49,6 +49,11 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
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)) {
--
2.15.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] led-triggers: allow writing 'default' to sysfs trigger attr
2017-11-28 6:38 [PATCH] led-triggers: allow writing 'default' to sysfs trigger attr Craig McQueen
@ 2017-11-28 12:07 ` Pavel Machek
2017-11-28 19:38 ` Jacek Anaszewski
2017-11-28 19:38 ` Jacek Anaszewski
0 siblings, 2 replies; 4+ messages in thread
From: Pavel Machek @ 2017-11-28 12:07 UTC (permalink / raw)
To: Craig McQueen; +Cc: linux-leds
[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]
On Tue 2017-11-28 17:38:20, Craig McQueen wrote:
> It calls led_trigger_set_default() to set the LED to its default
> trigger.
This needs corresponding change to documentation, at the very least.
Pavel
> 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 431123b048a2..f090a7806017 100644
> --- a/drivers/leds/led-triggers.c
> +++ b/drivers/leds/led-triggers.c
> @@ -49,6 +49,11 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
> 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)) {
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] led-triggers: allow writing 'default' to sysfs trigger attr
2017-11-28 12:07 ` Pavel Machek
@ 2017-11-28 19:38 ` Jacek Anaszewski
2017-11-28 19:38 ` Jacek Anaszewski
1 sibling, 0 replies; 4+ messages in thread
From: Jacek Anaszewski @ 2017-11-28 19:38 UTC (permalink / raw)
To: Pavel Machek, Craig McQueen; +Cc: linux-leds
On 11/28/2017 01:07 PM, Pavel Machek wrote:
> On Tue 2017-11-28 17:38:20, Craig McQueen wrote:
>> It calls led_trigger_set_default() to set the LED to its default
>> trigger.
>
> This needs corresponding change to documentation, at the very least.
I agree - Documentation/ABI/testing/sysfs-class-led will need an update.
>> 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 431123b048a2..f090a7806017 100644
>> --- a/drivers/leds/led-triggers.c
>> +++ b/drivers/leds/led-triggers.c
>> @@ -49,6 +49,11 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
>> goto unlock;
>> }
>>
>> + if (sysfs_streq(buf, "default")) {
>> + led_trigger_set_default(led_cdev);
>> + goto unlock;
>> + }
>> +
In an addition to that I'd extend led_trigger_show() to
list also "default" among available triggers if a LED class
device has its default_trigger property initialized and the
trigger is registered.
--
Best regards,
Jacek Anaszewski
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] led-triggers: allow writing 'default' to sysfs trigger attr
2017-11-28 12:07 ` Pavel Machek
2017-11-28 19:38 ` Jacek Anaszewski
@ 2017-11-28 19:38 ` Jacek Anaszewski
1 sibling, 0 replies; 4+ messages in thread
From: Jacek Anaszewski @ 2017-11-28 19:38 UTC (permalink / raw)
To: Pavel Machek, Craig McQueen; +Cc: linux-leds
On 11/28/2017 01:07 PM, Pavel Machek wrote:
> On Tue 2017-11-28 17:38:20, Craig McQueen wrote:
>> It calls led_trigger_set_default() to set the LED to its default
>> trigger.
>
> This needs corresponding change to documentation, at the very least.
I agree - Documentation/ABI/testing/sysfs-class-led will need an update.
>> 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 431123b048a2..f090a7806017 100644
>> --- a/drivers/leds/led-triggers.c
>> +++ b/drivers/leds/led-triggers.c
>> @@ -49,6 +49,11 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
>> goto unlock;
>> }
>>
>> + if (sysfs_streq(buf, "default")) {
>> + led_trigger_set_default(led_cdev);
>> + goto unlock;
>> + }
>> +
In an addition to that I'd extend led_trigger_show() to
list also "default" among available triggers if a LED class
device has its default_trigger property initialized and the
trigger has been registered.
--
Best regards,
Jacek Anaszewski
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-28 19:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28 6:38 [PATCH] led-triggers: allow writing 'default' to sysfs trigger attr Craig McQueen
2017-11-28 12:07 ` Pavel Machek
2017-11-28 19:38 ` Jacek Anaszewski
2017-11-28 19:38 ` Jacek Anaszewski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.