diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2007-11-10 13:29:04 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2007-12-07 09:06:53 +0000 |
commit | dc47206e552c0850ad11f7e9a1fca0a3c92f5d65 (patch) | |
tree | 01188f5ca89d295009a618e1be6c5cea2926a522 /drivers/leds/led-class.c | |
parent | f194d132e4971111f85c18c96067acffb13cee6d (diff) | |
download | kernel_samsung_smdk4412-dc47206e552c0850ad11f7e9a1fca0a3c92f5d65.tar.gz kernel_samsung_smdk4412-dc47206e552c0850ad11f7e9a1fca0a3c92f5d65.tar.bz2 kernel_samsung_smdk4412-dc47206e552c0850ad11f7e9a1fca0a3c92f5d65.zip |
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 4211293ce86..ba8b04b03b9 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) write_unlock(&leds_list_lock); #ifdef CONFIG_LEDS_TRIGGERS - rwlock_init(&led_cdev->trigger_lock); + init_rwsem(&led_cdev->trigger_lock); rc = device_create_file(led_cdev->dev, &dev_attr_trigger); if (rc) @@ -147,10 +147,10 @@ void led_classdev_unregister(struct led_classdev *led_cdev) device_remove_file(led_cdev->dev, &dev_attr_brightness); #ifdef CONFIG_LEDS_TRIGGERS device_remove_file(led_cdev->dev, &dev_attr_trigger); - write_lock(&led_cdev->trigger_lock); + down_write(&led_cdev->trigger_lock); if (led_cdev->trigger) led_trigger_set(led_cdev, NULL); - write_unlock(&led_cdev->trigger_lock); + up_write(&led_cdev->trigger_lock); #endif device_unregister(led_cdev->dev); |