led-triggers: allow writing 'default' to sysfs trigger attr
PATCH 1/1 led-triggers: allow writing 'default' to sysfs trigger attr
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(+)
drivers/leds/led-triggers.c +5 -0
@@ -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)) {
Signature · 1 line
2.15.0
Quoted 2 lines · Craig McQueen
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
Quoted 19 lines
drivers/leds/led-triggers.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/leds/led-triggers.c +5
-0@@ -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)) {
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 5 lines · Pavel Machek
Quoted 2 lines · Craig McQueen
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.
Quoted 11 lines
Quoted 11 lines
drivers/leds/led-triggers.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/leds/led-triggers.c +0
-0@@ -49,6 +49,11 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, goto unlock; }
Quoted 5 lines
drivers/leds/led-triggers.c ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, · line 56
Quoted 5 lines
drivers/leds/led-triggers.c +5
-0+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.
Signature · 2 lines
Best regards, Jacek Anaszewski
Quoted 5 lines · Pavel Machek
Quoted 2 lines · Craig McQueen
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.
Quoted 11 lines
Quoted 11 lines
drivers/leds/led-triggers.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/leds/led-triggers.c +0
-0@@ -49,6 +49,11 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, goto unlock; }
Quoted 5 lines
drivers/leds/led-triggers.c ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, · line 56
Quoted 5 lines
drivers/leds/led-triggers.c +5
-0+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.
Signature · 2 lines
Best regards, Jacek Anaszewski