Skip to content

Commit

Permalink
pwm-backlight: Fix bogus request for GPIO#0 when instantiated from DT
Browse files Browse the repository at this point in the history
commit 257462d ("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 <LW@KARO-electronics.de>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
Lothar Waßmann authored and Lee Jones committed Aug 20, 2014
1 parent 7d1311b commit 937222c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/video/backlight/pwm_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
data->max_brightness--;
}

data->enable_gpio = -EINVAL;
return 0;
}

Expand Down

0 comments on commit 937222c

Please sign in to comment.