From 937222c4dda495277a8dfbc18bf7e54fe670105c Mon Sep 17 00:00:00 2001 From: Lothar Waßmann Date: Wed, 20 Aug 2014 08:38:36 +0200 Subject: pwm-backlight: Fix bogus request for GPIO#0 when instantiated from DT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 257462dbf3ed ("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: Lothar Waßmann Acked-by: Thierry Reding Signed-off-by: Lee Jones --- drivers/video/backlight/pwm_bl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index d7a3d13e72ec..b85983e97f0a 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -173,6 +173,7 @@ static int pwm_backlight_parse_dt(struct device *dev, data->max_brightness--; } + data->enable_gpio = -EINVAL; return 0; } -- cgit