Commit 937222c4 authored by Lothar Waßmann's avatar Lothar Waßmann Committed by Lee Jones

pwm-backlight: Fix bogus request for GPIO#0 when instantiated from DT

commit 257462db ("pwm-backlight: switch to gpiod interface")
introduced a regression leading to acquiring a bogus GPIO-0 when
configured from DT without an 'enable-gpios' property.
The driver will happily accept the 0 initialized 'enable_gpio' member
of the struct platform_pwm_backlight_data as valid gpio number, and
request this GPIO as enable pin. In case of multiple driver instances,
the second will fail to register with the error message:
pwm-backlight backlight1.23: failed to request GPIO#0: -16

Fix this by setting enable_gpio in the pdata struct to -EINVAL.
Signed-off-by: default avatarLothar Waßmann <LW@KARO-electronics.de>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 7d1311b9
......@@ -173,6 +173,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
data->max_brightness--;
}
data->enable_gpio = -EINVAL;
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment