diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2007-11-10 08:29:04 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2007-12-07 04:06:53 -0500 |
commit | dc47206e552c0850ad11f7e9a1fca0a3c92f5d65 (patch) | |
tree | 01188f5ca89d295009a618e1be6c5cea2926a522 /drivers/leds/led-class.c | |
parent | f194d132e4971111f85c18c96067acffb13cee6d (diff) |
leds: Fix led trigger locking bugs
Convert part of the led trigger core from rw spinlocks to rw
semaphores. We're calling functions which can sleep from invalid
contexts otherwise. Fixes bug #9264.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/leds/led-class.c')
-rw-r--r-- | drivers/leds/led-class.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 4211293ce862..ba8b04b03b9f 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -111,7 +111,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
111 | write_unlock(&leds_list_lock); | 111 | write_unlock(&leds_list_lock); |
112 | 112 | ||
113 | #ifdef CONFIG_LEDS_TRIGGERS | 113 | #ifdef CONFIG_LEDS_TRIGGERS |
114 | rwlock_init(&led_cdev->trigger_lock); | 114 | init_rwsem(&led_cdev->trigger_lock); |
115 | 115 | ||
116 | rc = device_create_file(led_cdev->dev, &dev_attr_trigger); | 116 | rc = device_create_file(led_cdev->dev, &dev_attr_trigger); |
117 | if (rc) | 117 | if (rc) |
@@ -147,10 +147,10 @@ void led_classdev_unregister(struct led_classdev *led_cdev) | |||
147 | device_remove_file(led_cdev->dev, &dev_attr_brightness); | 147 | device_remove_file(led_cdev->dev, &dev_attr_brightness); |
148 | #ifdef CONFIG_LEDS_TRIGGERS | 148 | #ifdef CONFIG_LEDS_TRIGGERS |
149 | device_remove_file(led_cdev->dev, &dev_attr_trigger); | 149 | device_remove_file(led_cdev->dev, &dev_attr_trigger); |
150 | write_lock(&led_cdev->trigger_lock); | 150 | down_write(&led_cdev->trigger_lock); |
151 | if (led_cdev->trigger) | 151 | if (led_cdev->trigger) |
152 | led_trigger_set(led_cdev, NULL); | 152 | led_trigger_set(led_cdev, NULL); |
153 | write_unlock(&led_cdev->trigger_lock); | 153 | up_write(&led_cdev->trigger_lock); |
154 | #endif | 154 | #endif |
155 | 155 | ||
156 | device_unregister(led_cdev->dev); | 156 | device_unregister(led_cdev->dev); |