diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2013-01-22 08:39:54 -0500 |
---|---|---|
committer | Thierry Reding <thierry.reding@avionic-design.de> | 2013-01-31 07:47:51 -0500 |
commit | 83cfd72669ff708c9d21f214606be785ea8a685c (patch) | |
tree | 1db0fd4fd6f130766f3777f1b81d4891f73dd754 /drivers/video | |
parent | 928c44775bbf312332c5cb8df7c7451c1d8fba25 (diff) |
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.c | 13 |
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, | |||
134 | if (ret < 0) | 134 | if (ret < 0) |
135 | return ret; | 135 | return ret; |
136 | 136 | ||
137 | if (value >= data->max_brightness) { | ||
138 | dev_warn(dev, "invalid default brightness level: %u, using %u\n", | ||
139 | value, data->max_brightness - 1); | ||
140 | value = data->max_brightness - 1; | ||
141 | } | ||
142 | |||
143 | data->dft_brightness = value; | 137 | data->dft_brightness = value; |
144 | data->max_brightness--; | 138 | data->max_brightness--; |
145 | } | 139 | } |
@@ -248,6 +242,13 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
248 | goto err_alloc; | 242 | goto err_alloc; |
249 | } | 243 | } |
250 | 244 | ||
245 | if (data->dft_brightness > data->max_brightness) { | ||
246 | dev_warn(&pdev->dev, | ||
247 | "invalid default brightness level: %u, using %u\n", | ||
248 | data->dft_brightness, data->max_brightness); | ||
249 | data->dft_brightness = data->max_brightness; | ||
250 | } | ||
251 | |||
251 | bl->props.brightness = data->dft_brightness; | 252 | bl->props.brightness = data->dft_brightness; |
252 | backlight_update_status(bl); | 253 | backlight_update_status(bl); |
253 | 254 | ||