From: Ben Dooks <ben-linux@fluff.org>
To: Ben Dooks <ben-linux@fluff.org>
Cc: akpm@linux-foundation.org, linux-fbdev-devel@lists.sourceforge.net
Subject: Re: LCD: fix oops if driver only interested in .set_power
Date: Tue, 18 Nov 2008 18:31:47 +0000 [thread overview]
Message-ID: <20081118183147.GB15652@fluff.org.uk> (raw)
In-Reply-To: <20081118180350.390792130@fluff.org.uk>
On Tue, Nov 18, 2008 at 06:03:50PM +0000, Ben Dooks wrote:
> The LCD driver core calls LCD drivers when either the
> blanking state or the display mode has changed, but
> does not make any check to see if the called driver
> has a .set_mode method.
>
> This means if a driver only has a .set_power method
> then the system will OOPS on changing mode (and with
> the console semaphore held so you cannot easily see
> the problem).
>
> Fix the problem by ensuring that either callback is
> valid before calling it.
>
> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
> Index: linux.git/drivers/video/backlight/lcd.c
> ===================================================================
> --- linux.git.orig/drivers/video/backlight/lcd.c 2008-11-18 12:59:21.000000000 +0000
> +++ linux.git/drivers/video/backlight/lcd.c 2008-11-18 15:07:25.000000000 +0000
> @@ -43,9 +43,11 @@ static int fb_notifier_callback(struct n
> mutex_lock(&ld->ops_lock);
> if (!ld->ops->check_fb || ld->ops->check_fb(ld, evdata->info)) {
> if (event == FB_EVENT_BLANK)
> - ld->ops->set_power(ld, *(int *)evdata->data);
> + if (ld->ops->set_power)
> + ld->ops->set_power(ld, *(int *)evdata->data);
> else
sorry, needed to put {} around the outer if block to keep gcc
happy.
> - ld->ops->set_mode(ld, evdata->data);
> + if (ld->ops->set_mode)
> + ld->ops->set_mode(ld, evdata->data);
> }
> mutex_unlock(&ld->ops_lock);
> return 0;
>
> --
> Ben (ben@fluff.org, http://www.fluff.org/)
>
> 'a smiley only costs 4 bytes'
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
next parent reply other threads:[~2008-11-18 18:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20081118180350.390792130@fluff.org.uk>
2008-11-18 18:31 ` Ben Dooks [this message]
2008-11-18 18:31 LCD: fix oops if driver only interested in .set_power Ben Dooks
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=20081118183147.GB15652@fluff.org.uk \
--to=ben-linux@fluff.org \
--cc=akpm@linux-foundation.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
/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;
as well as URLs for NNTP newsgroup(s).