Commit 11e043b5 authored by ZHAO Gang's avatar ZHAO Gang Committed by Bryan Wu

leds: replace list_for_each with list_for_each_entry

Use the more convenient macro.
Signed-off-by: default avatarZHAO Gang <gamerh2o@gmail.com>
Signed-off-by: default avatarBryan Wu <cooloney@gmail.com>
parent 00d19552
...@@ -242,18 +242,14 @@ EXPORT_SYMBOL_GPL(led_trigger_unregister); ...@@ -242,18 +242,14 @@ EXPORT_SYMBOL_GPL(led_trigger_unregister);
void led_trigger_event(struct led_trigger *trig, void led_trigger_event(struct led_trigger *trig,
enum led_brightness brightness) enum led_brightness brightness)
{ {
struct list_head *entry; struct led_classdev *led_cdev;
if (!trig) if (!trig)
return; return;
read_lock(&trig->leddev_list_lock); read_lock(&trig->leddev_list_lock);
list_for_each(entry, &trig->led_cdevs) { list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list)
struct led_classdev *led_cdev;
led_cdev = list_entry(entry, struct led_classdev, trig_list);
led_set_brightness(led_cdev, brightness); led_set_brightness(led_cdev, brightness);
}
read_unlock(&trig->leddev_list_lock); read_unlock(&trig->leddev_list_lock);
} }
EXPORT_SYMBOL_GPL(led_trigger_event); EXPORT_SYMBOL_GPL(led_trigger_event);
...@@ -264,16 +260,13 @@ static void led_trigger_blink_setup(struct led_trigger *trig, ...@@ -264,16 +260,13 @@ static void led_trigger_blink_setup(struct led_trigger *trig,
int oneshot, int oneshot,
int invert) int invert)
{ {
struct list_head *entry; struct led_classdev *led_cdev;
if (!trig) if (!trig)
return; return;
read_lock(&trig->leddev_list_lock); read_lock(&trig->leddev_list_lock);
list_for_each(entry, &trig->led_cdevs) { list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list) {
struct led_classdev *led_cdev;
led_cdev = list_entry(entry, struct led_classdev, trig_list);
if (oneshot) if (oneshot)
led_blink_set_oneshot(led_cdev, delay_on, delay_off, led_blink_set_oneshot(led_cdev, delay_on, delay_off,
invert); invert);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment