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>
This commit is contained in:
parent
cc2f2e10c2
commit
de6f2a7fa2
|
@ -564,18 +564,17 @@ static int pwm_backlight_probe(struct platform_device *pdev)
|
||||||
memset(&props, 0, sizeof(struct backlight_properties));
|
memset(&props, 0, sizeof(struct backlight_properties));
|
||||||
|
|
||||||
if (data->levels) {
|
if (data->levels) {
|
||||||
|
pb->levels = data->levels;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For the DT case, only when brightness levels is defined
|
* For the DT case, only when brightness levels is defined
|
||||||
* data->levels is filled. For the non-DT case, data->levels
|
* data->levels is filled. For the non-DT case, data->levels
|
||||||
* can come from platform data, however is not usual.
|
* 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)
|
if (data->levels[i] > pb->scale)
|
||||||
pb->scale = data->levels[i];
|
pb->scale = data->levels[i];
|
||||||
|
|
||||||
pb->levels = data->levels;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pwm_backlight_is_linear(data))
|
if (pwm_backlight_is_linear(data))
|
||||||
props.scale = BACKLIGHT_SCALE_LINEAR;
|
props.scale = BACKLIGHT_SCALE_LINEAR;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue