diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2007-12-31 18:09:44 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2007-12-31 18:09:44 -0500 |
commit | 72f8da329e07ad8a72c1f0e96b8955cfeb7c7329 (patch) | |
tree | 7440f70caf2fb70e987f814cebcdf233a17b425c /drivers/leds/led-triggers.c | |
parent | e697789d64f8748cb219d7f5c413c512953802cc (diff) |
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) | |||
169 | up_write(&triggers_list_lock); | 169 | up_write(&triggers_list_lock); |
170 | 170 | ||
171 | /* Register with any LEDs that have this as a default trigger */ | 171 | /* Register with any LEDs that have this as a default trigger */ |
172 | read_lock(&leds_list_lock); | 172 | down_read(&leds_list_lock); |
173 | list_for_each_entry(led_cdev, &leds_list, node) { | 173 | list_for_each_entry(led_cdev, &leds_list, node) { |
174 | down_write(&led_cdev->trigger_lock); | 174 | down_write(&led_cdev->trigger_lock); |
175 | if (!led_cdev->trigger && led_cdev->default_trigger && | 175 | if (!led_cdev->trigger && led_cdev->default_trigger && |
@@ -177,7 +177,7 @@ int led_trigger_register(struct led_trigger *trigger) | |||
177 | led_trigger_set(led_cdev, trigger); | 177 | led_trigger_set(led_cdev, trigger); |
178 | up_write(&led_cdev->trigger_lock); | 178 | up_write(&led_cdev->trigger_lock); |
179 | } | 179 | } |
180 | read_unlock(&leds_list_lock); | 180 | up_read(&leds_list_lock); |
181 | 181 | ||
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
@@ -212,14 +212,14 @@ void led_trigger_unregister(struct led_trigger *trigger) | |||
212 | up_write(&triggers_list_lock); | 212 | up_write(&triggers_list_lock); |
213 | 213 | ||
214 | /* Remove anyone actively using this trigger */ | 214 | /* Remove anyone actively using this trigger */ |
215 | read_lock(&leds_list_lock); | 215 | down_read(&leds_list_lock); |
216 | list_for_each_entry(led_cdev, &leds_list, node) { | 216 | list_for_each_entry(led_cdev, &leds_list, node) { |
217 | down_write(&led_cdev->trigger_lock); | 217 | down_write(&led_cdev->trigger_lock); |
218 | if (led_cdev->trigger == trigger) | 218 | if (led_cdev->trigger == trigger) |
219 | led_trigger_set(led_cdev, NULL); | 219 | led_trigger_set(led_cdev, NULL); |
220 | up_write(&led_cdev->trigger_lock); | 220 | up_write(&led_cdev->trigger_lock); |
221 | } | 221 | } |
222 | read_unlock(&leds_list_lock); | 222 | up_read(&leds_list_lock); |
223 | } | 223 | } |
224 | 224 | ||
225 | void led_trigger_unregister_simple(struct led_trigger *trigger) | 225 | void led_trigger_unregister_simple(struct led_trigger *trigger) |