From: Richard Purdie <rpurdie@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
akpm <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] backlight: grab ops_lock before testing bd->ops
Date: Mon, 22 Nov 2010 09:59:07 +0000 [thread overview]
Message-ID: <1290419947.1272.16677.camel@rex> (raw)
In-Reply-To: <1290418989-27653-1-git-send-email-u.kleine-koenig@pengutronix.de>
On Mon, 2010-11-22 at 10:43 +0100, Uwe Kleine-König wrote:
> 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Richard Purdie <rpurdie@linux.intel.com>
> ---
> 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 e207810..0870329 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)
> {
> struct backlight_device *bd = to_backlight_device(dev);
>
> - if (bd->ops->options & BL_CORE_SUSPENDRESUME) {
> - mutex_lock(&bd->ops_lock);
> + mutex_lock(&bd->ops_lock);
> + if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) {
> bd->props.state |= BL_CORE_SUSPENDED;
> backlight_update_status(bd);
> - mutex_unlock(&bd->ops_lock);
> }
> + mutex_unlock(&bd->ops_lock);
>
> return 0;
> }
> @@ -211,12 +211,12 @@ static int backlight_resume(struct device *dev)
> {
> struct backlight_device *bd = to_backlight_device(dev);
>
> - if (bd->ops->options & BL_CORE_SUSPENDRESUME) {
> - mutex_lock(&bd->ops_lock);
> + mutex_lock(&bd->ops_lock);
> + if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) {
> bd->props.state &= ~BL_CORE_SUSPENDED;
> backlight_update_status(bd);
> - mutex_unlock(&bd->ops_lock);
> }
> + mutex_unlock(&bd->ops_lock);
>
> return 0;
> }
next prev parent reply other threads:[~2010-11-22 9:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-22 9:43 [PATCH] backlight: grab ops_lock before testing bd->ops Uwe Kleine-König
2010-11-22 9:59 ` Richard Purdie [this message]
2010-11-22 10:05 ` Uwe Kleine-König
2010-11-22 17:53 ` [stable] " Greg KH
2010-11-23 8:56 ` Uwe Kleine-König
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=1290419947.1272.16677.camel@rex \
--to=rpurdie@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox