• Home
  • Raw
  • Download

Lines Matching refs:trig

31 trigger_relevant(struct led_classdev *led_cdev, struct led_trigger *trig)  in trigger_relevant()  argument
33 return !trig->trigger_type || trig->trigger_type == led_cdev->trigger_type; in trigger_relevant()
42 struct led_trigger *trig; in led_trigger_write() local
58 list_for_each_entry(trig, &trigger_list, next_trig) { in led_trigger_write()
59 if (sysfs_streq(buf, trig->name) && trigger_relevant(led_cdev, trig)) { in led_trigger_write()
61 led_trigger_set(led_cdev, trig); in led_trigger_write()
97 struct led_trigger *trig; in led_trigger_format() local
101 list_for_each_entry(trig, &trigger_list, next_trig) { in led_trigger_format()
104 if (!trigger_relevant(led_cdev, trig)) in led_trigger_format()
107 hit = led_cdev->trigger && !strcmp(led_cdev->trigger->name, trig->name); in led_trigger_format()
111 trig->name, hit ? "]" : ""); in led_trigger_format()
158 int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig) in led_trigger_set() argument
166 if (!led_cdev->trigger && !trig) in led_trigger_set()
169 name = trig ? trig->name : "none"; in led_trigger_set()
188 if (trig) { in led_trigger_set()
189 write_lock_irqsave(&trig->leddev_list_lock, flags); in led_trigger_set()
190 list_add_tail(&led_cdev->trig_list, &trig->led_cdevs); in led_trigger_set()
191 write_unlock_irqrestore(&trig->leddev_list_lock, flags); in led_trigger_set()
192 led_cdev->trigger = trig; in led_trigger_set()
194 if (trig->activate) in led_trigger_set()
195 ret = trig->activate(led_cdev); in led_trigger_set()
202 ret = device_add_groups(led_cdev->dev, trig->groups); in led_trigger_set()
222 if (trig->deactivate) in led_trigger_set()
223 trig->deactivate(led_cdev); in led_trigger_set()
248 struct led_trigger *trig; in led_trigger_set_default() local
255 list_for_each_entry(trig, &trigger_list, next_trig) { in led_trigger_set_default()
256 if (!strcmp(led_cdev->default_trigger, trig->name) && in led_trigger_set_default()
257 trigger_relevant(led_cdev, trig)) { in led_trigger_set_default()
259 led_trigger_set(led_cdev, trig); in led_trigger_set_default()
268 void led_trigger_rename_static(const char *name, struct led_trigger *trig) in led_trigger_rename_static() argument
271 BUG_ON(name == trig->name); in led_trigger_rename_static()
276 strcpy((char *)trig->name, name); in led_trigger_rename_static()
283 int led_trigger_register(struct led_trigger *trig) in led_trigger_register() argument
288 rwlock_init(&trig->leddev_list_lock); in led_trigger_register()
289 INIT_LIST_HEAD(&trig->led_cdevs); in led_trigger_register()
294 if (!strcmp(_trig->name, trig->name) && in led_trigger_register()
295 (trig->trigger_type == _trig->trigger_type || in led_trigger_register()
296 !trig->trigger_type || !_trig->trigger_type)) { in led_trigger_register()
302 list_add_tail(&trig->next_trig, &trigger_list); in led_trigger_register()
310 !strcmp(led_cdev->default_trigger, trig->name) && in led_trigger_register()
311 trigger_relevant(led_cdev, trig)) { in led_trigger_register()
313 led_trigger_set(led_cdev, trig); in led_trigger_register()
323 void led_trigger_unregister(struct led_trigger *trig) in led_trigger_unregister() argument
327 if (list_empty_careful(&trig->next_trig)) in led_trigger_unregister()
332 list_del_init(&trig->next_trig); in led_trigger_unregister()
339 if (led_cdev->trigger == trig) in led_trigger_unregister()
353 struct led_trigger *trig) in devm_led_trigger_register() argument
363 *dr = trig; in devm_led_trigger_register()
365 rc = led_trigger_register(trig); in devm_led_trigger_register()
377 void led_trigger_event(struct led_trigger *trig, in led_trigger_event() argument
383 if (!trig) in led_trigger_event()
386 read_lock_irqsave(&trig->leddev_list_lock, flags); in led_trigger_event()
387 list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list) in led_trigger_event()
389 read_unlock_irqrestore(&trig->leddev_list_lock, flags); in led_trigger_event()
393 static void led_trigger_blink_setup(struct led_trigger *trig, in led_trigger_blink_setup() argument
402 if (!trig) in led_trigger_blink_setup()
405 read_lock_irqsave(&trig->leddev_list_lock, flags); in led_trigger_blink_setup()
406 list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list) { in led_trigger_blink_setup()
413 read_unlock_irqrestore(&trig->leddev_list_lock, flags); in led_trigger_blink_setup()
416 void led_trigger_blink(struct led_trigger *trig, in led_trigger_blink() argument
420 led_trigger_blink_setup(trig, delay_on, delay_off, 0, 0); in led_trigger_blink()
424 void led_trigger_blink_oneshot(struct led_trigger *trig, in led_trigger_blink_oneshot() argument
429 led_trigger_blink_setup(trig, delay_on, delay_off, 1, invert); in led_trigger_blink_oneshot()
435 struct led_trigger *trig; in led_trigger_register_simple() local
438 trig = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); in led_trigger_register_simple()
440 if (trig) { in led_trigger_register_simple()
441 trig->name = name; in led_trigger_register_simple()
442 err = led_trigger_register(trig); in led_trigger_register_simple()
444 kfree(trig); in led_trigger_register_simple()
445 trig = NULL; in led_trigger_register_simple()
453 *tp = trig; in led_trigger_register_simple()
457 void led_trigger_unregister_simple(struct led_trigger *trig) in led_trigger_unregister_simple() argument
459 if (trig) in led_trigger_unregister_simple()
460 led_trigger_unregister(trig); in led_trigger_unregister_simple()
461 kfree(trig); in led_trigger_unregister_simple()