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>
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 4211293..ba8b04b 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -111,7 +111,7 @@
 	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 @@
 	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);