diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2007-12-31 23:09:44 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2007-12-31 23:09:44 +0000 |
commit | 72f8da329e07ad8a72c1f0e96b8955cfeb7c7329 (patch) | |
tree | 7440f70caf2fb70e987f814cebcdf233a17b425c /drivers/leds/led-triggers.c | |
parent | e697789d64f8748cb219d7f5c413c512953802cc (diff) | |
download | lwn-72f8da329e07ad8a72c1f0e96b8955cfeb7c7329.tar.gz lwn-72f8da329e07ad8a72c1f0e96b8955cfeb7c7329.zip |
leds: Fix leds_list_lock locking issues
Covert leds_list_lock to a rw_sempahore to match previous LED trigger
locking fixes, fixing lock ordering.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/leds/led-triggers.c')
-rw-r--r-- | drivers/leds/led-triggers.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 0bdb786210b1..13c9026d68af 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -169,7 +169,7 @@ int led_trigger_register(struct led_trigger *trigger) up_write(&triggers_list_lock); /* Register with any LEDs that have this as a default trigger */ - read_lock(&leds_list_lock); + down_read(&leds_list_lock); list_for_each_entry(led_cdev, &leds_list, node) { down_write(&led_cdev->trigger_lock); if (!led_cdev->trigger && led_cdev->default_trigger && @@ -177,7 +177,7 @@ int led_trigger_register(struct led_trigger *trigger) led_trigger_set(led_cdev, trigger); up_write(&led_cdev->trigger_lock); } - read_unlock(&leds_list_lock); + up_read(&leds_list_lock); return 0; } @@ -212,14 +212,14 @@ void led_trigger_unregister(struct led_trigger *trigger) up_write(&triggers_list_lock); /* Remove anyone actively using this trigger */ - read_lock(&leds_list_lock); + down_read(&leds_list_lock); list_for_each_entry(led_cdev, &leds_list, node) { down_write(&led_cdev->trigger_lock); if (led_cdev->trigger == trigger) led_trigger_set(led_cdev, NULL); up_write(&led_cdev->trigger_lock); } - read_unlock(&leds_list_lock); + up_read(&leds_list_lock); } void led_trigger_unregister_simple(struct led_trigger *trigger) |