From: David Brownell Date: Mon, 11 Dec 2006 22:27:07 +0000 (-0800) Subject: ARM: OMAP: osk+mistral backlight, power, driver specific X-Git-Tag: v2.6.19-omap1~4 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=039d5790edbe5432b5d1e38f01ded217f598a278;p=linux-2.6-omap-h63xx.git ARM: OMAP: osk+mistral backlight, power, driver specific Generic backlight driver updates: - Don't oops on misconfigured platform device - Writing to /sys/class/backlight/omap-bl/brightness now works Signed-off-by: David Brownell Signed-off-by: Tony Lindgren --- diff --git a/drivers/video/backlight/omap_bl.c b/drivers/video/backlight/omap_bl.c index d217cc223e3..22189b1a54c 100644 --- a/drivers/video/backlight/omap_bl.c +++ b/drivers/video/backlight/omap_bl.c @@ -110,8 +110,7 @@ static int omapbl_update_status(struct backlight_device *dev) struct omap_backlight *bl = class_get_devdata(&dev->class_dev); if (bl->current_intensity != dev->props->brightness) { - if (dev->props->brightness > OMAPBL_MAX_INTENSITY || - dev->props->brightness < 0) + if (dev->props->brightness < 0) return -EPERM; /* Leave current_intensity untouched */ if (bl->powermode == FB_BLANK_UNBLANK) @@ -135,6 +134,7 @@ static struct backlight_properties omapbl_data = { .owner = THIS_MODULE, .get_brightness = omapbl_get_intensity, .update_status = omapbl_update_status, + .max_brightness = OMAPBL_MAX_INTENSITY, }; static int omapbl_probe(struct platform_device *pdev) @@ -143,12 +143,20 @@ static int omapbl_probe(struct platform_device *pdev) struct omap_backlight *bl; struct omap_backlight_config *pdata = pdev->dev.platform_data; + if (!pdata) + return -ENXIO; + omapbl_data.check_fb = pdata->check_fb; bl = kzalloc(sizeof(struct omap_backlight), GFP_KERNEL); if (unlikely(!bl)) return -ENOMEM; + /* REVISIT backlight API glitch: we can't associate the + * class device with "pdev" ... probably pass &pdev->dev + * instead of a string. + */ + dev = backlight_device_register("omap-bl", bl, &omapbl_data); if (IS_ERR(dev)) { kfree(bl);