summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2013-01-22 14:39:54 +0100
committerThierry Reding <thierry.reding@avionic-design.de>2013-01-31 13:47:51 +0100
commit83cfd72669ff708c9d21f214606be785ea8a685c (patch)
tree1db0fd4fd6f130766f3777f1b81d4891f73dd754 /drivers/video
parentpwm: Export pwm_{set,get}_chip_data() (diff)
downloadlinux-83cfd72669ff708c9d21f214606be785ea8a685c.tar.xz
linux-83cfd72669ff708c9d21f214606be785ea8a685c.zip
pwm_backlight: Validate dft_brightness in main probe function
Move the dft_brightness validity check from the DT parsing function to the main probe. In this way we can validate it in case we are booting with or without DT. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/pwm_bl.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 4af6d1302f17..a71ef4a79ec4 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -134,12 +134,6 @@ static int pwm_backlight_parse_dt(struct device *dev,
if (ret < 0)
return ret;
- if (value >= data->max_brightness) {
- dev_warn(dev, "invalid default brightness level: %u, using %u\n",
- value, data->max_brightness - 1);
- value = data->max_brightness - 1;
- }
-
data->dft_brightness = value;
data->max_brightness--;
}
@@ -248,6 +242,13 @@ static int pwm_backlight_probe(struct platform_device *pdev)
goto err_alloc;
}
+ if (data->dft_brightness > data->max_brightness) {
+ dev_warn(&pdev->dev,
+ "invalid default brightness level: %u, using %u\n",
+ data->dft_brightness, data->max_brightness);
+ data->dft_brightness = data->max_brightness;
+ }
+
bl->props.brightness = data->dft_brightness;
backlight_update_status(bl);