diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-24 15:57:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-24 16:50:47 -0500 |
commit | d1d73578e053b981c3611e5a211534290d24a5eb (patch) | |
tree | 3879428554320c30bc3ccfd0b217710e256ca36f /drivers/video | |
parent | b38eeaae267e4cd385ababcc2df82f6c46fc8633 (diff) |
backlight: grab ops_lock before testing bd->ops
According to the comment describing ops_lock in the definition of struct
backlight_device and when comparing with other functions in backlight.c
the mutex must be hold when checking ops to be non-NULL.
Fixes a problem added by c835ee7f4154992e6 ("backlight: Add suspend/resume
support to the backlight core") in Jan 2009.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Richard Purdie <rpurdie@linux.intel.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/backlight/backlight.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index e207810bba3c..08703299ef61 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -197,12 +197,12 @@ static int backlight_suspend(struct device *dev, pm_message_t state) | |||
197 | { | 197 | { |
198 | struct backlight_device *bd = to_backlight_device(dev); | 198 | struct backlight_device *bd = to_backlight_device(dev); |
199 | 199 | ||
200 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | 200 | mutex_lock(&bd->ops_lock); |
201 | mutex_lock(&bd->ops_lock); | 201 | if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
202 | bd->props.state |= BL_CORE_SUSPENDED; | 202 | bd->props.state |= BL_CORE_SUSPENDED; |
203 | backlight_update_status(bd); | 203 | backlight_update_status(bd); |
204 | mutex_unlock(&bd->ops_lock); | ||
205 | } | 204 | } |
205 | mutex_unlock(&bd->ops_lock); | ||
206 | 206 | ||
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
@@ -211,12 +211,12 @@ static int backlight_resume(struct device *dev) | |||
211 | { | 211 | { |
212 | struct backlight_device *bd = to_backlight_device(dev); | 212 | struct backlight_device *bd = to_backlight_device(dev); |
213 | 213 | ||
214 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | 214 | mutex_lock(&bd->ops_lock); |
215 | mutex_lock(&bd->ops_lock); | 215 | if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
216 | bd->props.state &= ~BL_CORE_SUSPENDED; | 216 | bd->props.state &= ~BL_CORE_SUSPENDED; |
217 | backlight_update_status(bd); | 217 | backlight_update_status(bd); |
218 | mutex_unlock(&bd->ops_lock); | ||
219 | } | 218 | } |
219 | mutex_unlock(&bd->ops_lock); | ||
220 | 220 | ||
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |