From: Pavel Machek <pavel@suse.cz>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Richard Purdie <rpurdie@linux.intel.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: Fix locking for WM8350
Date: Sat, 15 Nov 2008 18:31:10 +0100 [thread overview]
Message-ID: <20081115173110.GD1523@ucw.cz> (raw)
In-Reply-To: <1226588269-17642-1-git-send-email-broonie@opensource.wolfsonmicro.com>
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
next prev parent reply other threads:[~2008-11-15 17:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-13 12:39 [PATCH] leds: Add WM8350 LED driver Mark Brown
2008-11-13 14:57 ` [PATCH] leds: Fix locking for WM8350 Mark Brown
2008-11-15 17:31 ` Pavel Machek [this message]
2008-11-15 17:50 ` Mark Brown
2008-11-15 18:51 ` Pavel Machek
2008-11-15 19:14 ` Mark Brown
2008-11-17 15:33 ` Richard Purdie
2008-11-17 23:05 ` Mark Brown
2008-11-18 8:33 ` Pavel Machek
2008-11-14 23:19 ` [PATCH] leds: Add WM8350 LED driver Andrew Morton
2008-11-17 11:57 ` Mark Brown
2008-11-15 17:29 ` Pavel Machek
2008-11-15 17:43 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081115173110.GD1523@ucw.cz \
--to=pavel@suse.cz \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.