lkml.org 
[lkml]   [2008]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] leds: Fix locking for WM8350
On Thu 2008-11-13 14:57:49, Mark Brown wrote:
> LED API functions aren't allowed to sleep so we can't take a lock when
> setting the brightness of the LED.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>
> Sorry, I managed to drop this fix when moving the driver over to
> mainline for submission. I'll roll it into the original patch in any
> future submissions.
>
> drivers/leds/leds-wm8350.c | 3 ---
> 1 files changed, 0 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/leds/leds-wm8350.c b/drivers/leds/leds-wm8350.c
> index f3e5af3..283625c 100644
> --- a/drivers/leds/leds-wm8350.c
> +++ b/drivers/leds/leds-wm8350.c
> @@ -170,10 +170,7 @@ static void wm8350_led_set(struct led_classdev *led_cdev,
> {
> struct wm8350_led *led = to_wm8350_led(led_cdev);
>
> - mutex_lock(&led->mutex);
> led->value = value;
> - mutex_unlock(&led->mutex);
> -
> schedule_work(&led->work);
> }

Unfortunately, now you write to value w/o locking -> races
possible. Maybe you need to make value atomic_t?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


\
 
 \ /
  Last update: 2008-11-15 18:33    [W:0.054 / U:1.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site