14 #include <linux/module.h>
15 #include <linux/kernel.h>
17 #include <linux/list.h>
19 #include <linux/device.h>
23 #include <linux/slab.h>
38 char trigger_name[TRIG_NAME_MAX];
39 struct led_trigger *trig;
42 trigger_name[
sizeof(trigger_name) - 1] =
'\0';
43 strncpy(trigger_name, buf,
sizeof(trigger_name) - 1);
44 len =
strlen(trigger_name);
46 if (len && trigger_name[len - 1] ==
'\n')
47 trigger_name[len - 1] =
'\0';
49 if (!
strcmp(trigger_name,
"none")) {
56 if (!
strcmp(trigger_name, trig->name)) {
75 struct led_trigger *trig;
81 if (!led_cdev->trigger)
82 len +=
sprintf(buf+len,
"[none] ");
84 len +=
sprintf(buf+len,
"none ");
87 if (led_cdev->trigger && !
strcmp(led_cdev->trigger->
name,
89 len +=
sprintf(buf+len,
"[%s] ", trig->name);
91 len +=
sprintf(buf+len,
"%s ", trig->name);
93 up_read(&led_cdev->trigger_lock);
109 name = trig ? trig->name :
"none";
113 if (led_cdev->trigger) {
120 if (led_cdev->trigger->deactivate)
121 led_cdev->trigger->deactivate(led_cdev);
122 led_cdev->trigger =
NULL;
129 led_cdev->trigger = trig;
131 trig->activate(led_cdev);
153 struct led_trigger *trig;
174 struct led_trigger *_trig;
177 INIT_LIST_HEAD(&trig->led_cdevs);
182 if (!
strcmp(_trig->name, trig->name)) {
219 if (led_cdev->trigger == trig)
248 static void led_trigger_blink_setup(
struct led_trigger *trig,
249 unsigned long *delay_on,
250 unsigned long *delay_off,
274 unsigned long *delay_on,
275 unsigned long *delay_off)
277 led_trigger_blink_setup(trig, delay_on, delay_off, 0, 0);
282 unsigned long *delay_on,
283 unsigned long *delay_off,
286 led_trigger_blink_setup(trig, delay_on, delay_off, 1, invert);
292 struct led_trigger *trig;
295 trig = kzalloc(
sizeof(
struct led_trigger),
GFP_KERNEL);
304 " (%d)\n", name, err);
308 " (no memory)\n", name);