From patchwork Sat Jun 5 21:12:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 104489 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o55LJ6ln024399 for ; Sat, 5 Jun 2010 21:19:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932729Ab0FEVTG (ORCPT ); Sat, 5 Jun 2010 17:19:06 -0400 Received: from mail.pripojeni.net ([217.66.174.14]:47222 "EHLO mail.jetsystems.cz" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S932702Ab0FEVTF (ORCPT ); Sat, 5 Jun 2010 17:19:05 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 05 Jun 2010 21:19:06 +0000 (UTC) X-Greylist: delayed 384 seconds by postgrey-1.27 at vger.kernel.org; Sat, 05 Jun 2010 17:19:05 EDT Received: from bellona ([217.66.174.142]) by mail.jetsystems.cz (Kerio Connect 7.0.0 patch 1); Sat, 5 Jun 2010 23:21:05 +0200 From: Jiri Slaby To: rpurdie@rpsys.net Cc: akpm@linux-foundation.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, jirislaby@gmail.com Subject: [PATCH 1/1] LEDS: leds-input, fix sleep inside atomic Date: Sat, 5 Jun 2010 23:12:22 +0200 Message-Id: <1275772342-25094-1-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 1.7.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org diff --git a/drivers/leds/leds-input.c b/drivers/leds/leds-input.c index 93ab5ae..794155a 100644 --- a/drivers/leds/leds-input.c +++ b/drivers/leds/leds-input.c @@ -92,7 +92,7 @@ static struct led_trigger input_led_triggers[LED_CNT] = { DEFINE_INPUT_LED_TRIGGER(LED_CHARGING, "charging"), }; /* Lock for registration coherency */ -static DEFINE_SPINLOCK(input_led_registered_lock); +static DEFINE_MUTEX(input_led_registered_lock); /* Which global LED classes and triggers are registered */ static unsigned long input_led_registered[BITS_TO_LONGS(LED_CNT)]; @@ -159,7 +159,6 @@ static int input_led_connect(struct input_handler *handler, { struct input_handle *handle; int i, error = 0; - unsigned long flags; struct led_classdev *leds; if (!test_bit(EV_LED, dev->keybit)) @@ -187,7 +186,7 @@ static int input_led_connect(struct input_handler *handler, goto err; /* lazily register missing global input LEDs */ - spin_lock_irqsave(&input_led_registered_lock, flags); + mutex_lock(&input_led_registered_lock); for (i = 0; i < LED_CNT; i++) if (input_leds[i].name && !test_bit(i, input_led_registered) @@ -199,7 +198,7 @@ static int input_led_connect(struct input_handler *handler, else led_trigger_unregister(&input_led_triggers[i]); } - spin_unlock_irqrestore(&input_led_registered_lock, flags); + mutex_unlock(&input_led_registered_lock); /* and register this device's LEDs */ for (i = 0; i < LED_CNT; i++) @@ -239,7 +238,6 @@ err: static void input_led_disconnect(struct input_handle *handle) { int unregister, i; - unsigned long flags; struct led_classdev *leds = handle->private; for (i = 0; i < LED_CNT; i++) @@ -249,7 +247,7 @@ static void input_led_disconnect(struct input_handle *handle) input_unregister_handle(handle); input_led_delete_handle(handle); - spin_lock_irqsave(&input_led_registered_lock, flags); + mutex_lock(&input_led_registered_lock); for (i = 0; i < LED_CNT; i++) { if (!test_bit(i, input_led_registered)) continue; @@ -268,7 +266,7 @@ static void input_led_disconnect(struct input_handle *handle) led_trigger_unregister(&input_led_triggers[i]); clear_bit(i, input_led_registered); } - spin_unlock_irqrestore(&input_led_registered_lock, flags); + mutex_unlock(&input_led_registered_lock); } /* Only handle input devices which have LEDs */