[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1358861996-27194-3-git-send-email-peter.ujfalusi@ti.com>
Date: Tue, 22 Jan 2013 14:39:54 +0100
From: Peter Ujfalusi <peter.ujfalusi@...com>
To: Richard Purdie <rpurdie@...ys.net>
CC: Grant Likely <grant.likely@...retlab.ca>,
Rob Landley <rob@...dley.net>,
Thierry Reding <thierry.reding@...onic-design.de>,
Florian Tobias Schandinat <FlorianSchandinat@....de>,
Andrew Morton <akpm@...ux-foundation.org>,
<devicetree-discuss@...ts.ozlabs.org>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-fbdev@...r.kernel.org>
Subject: [PATCH 2/4] 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@...com>
---
drivers/video/backlight/pwm_bl.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index f0d6854..2a81c24 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -135,12 +135,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;
}
@@ -249,6 +243,12 @@ 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);
--
1.8.1.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists