Skip to content

Commit

Permalink
leds: replace list_for_each with list_for_each_entry
Browse files Browse the repository at this point in the history
Use the more convenient macro.

Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
  • Loading branch information
zhao-gang authored and cooloney committed Jan 28, 2014
1 parent 00d1955 commit 11e043b
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions drivers/leds/led-triggers.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,14 @@ EXPORT_SYMBOL_GPL(led_trigger_unregister);
void led_trigger_event(struct led_trigger *trig,
enum led_brightness brightness)
{
struct list_head *entry;
struct led_classdev *led_cdev;

if (!trig)
return;

read_lock(&trig->leddev_list_lock);
list_for_each(entry, &trig->led_cdevs) {
struct led_classdev *led_cdev;

led_cdev = list_entry(entry, struct led_classdev, trig_list);
list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list)
led_set_brightness(led_cdev, brightness);
}
read_unlock(&trig->leddev_list_lock);
}
EXPORT_SYMBOL_GPL(led_trigger_event);
Expand All @@ -264,16 +260,13 @@ static void led_trigger_blink_setup(struct led_trigger *trig,
int oneshot,
int invert)
{
struct list_head *entry;
struct led_classdev *led_cdev;

if (!trig)
return;

read_lock(&trig->leddev_list_lock);
list_for_each(entry, &trig->led_cdevs) {
struct led_classdev *led_cdev;

led_cdev = list_entry(entry, struct led_classdev, trig_list);
list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list) {
if (oneshot)
led_blink_set_oneshot(led_cdev, delay_on, delay_off,
invert);
Expand Down

0 comments on commit 11e043b

Please sign in to comment.