diff options
author | Matthias Kaehlcke <mka@chromium.org> | 2019-10-02 18:56:01 +0200 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2019-10-14 09:57:45 +0200 |
commit | de6f2a7fa2c9563266e2a3239e16b117daf22b47 (patch) | |
tree | dc3d58df4414e32a169bf2a20fa84c310298a324 /drivers/video/backlight | |
parent | dt-bindings: backlight: Add led-backlight binding (diff) | |
download | linux-de6f2a7fa2c9563266e2a3239e16b117daf22b47.tar.xz linux-de6f2a7fa2c9563266e2a3239e16b117daf22b47.zip |
backlight: pwm_bl: Don't assign levels table repeatedly
pwm_backlight_probe() re-assigns pb->levels for every brightness
level. This is not needed and was likely not intended, since
neither side of the assignment changes during the loop. Assign
the field only once.
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r-- | drivers/video/backlight/pwm_bl.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 746eebc411df..05d3b3802658 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -564,18 +564,17 @@ static int pwm_backlight_probe(struct platform_device *pdev) memset(&props, 0, sizeof(struct backlight_properties)); if (data->levels) { + pb->levels = data->levels; + /* * For the DT case, only when brightness levels is defined * data->levels is filled. For the non-DT case, data->levels * can come from platform data, however is not usual. */ - for (i = 0; i <= data->max_brightness; i++) { + for (i = 0; i <= data->max_brightness; i++) if (data->levels[i] > pb->scale) pb->scale = data->levels[i]; - pb->levels = data->levels; - } - if (pwm_backlight_is_linear(data)) props.scale = BACKLIGHT_SCALE_LINEAR; else |