3e9f5271c5c61d635d2bffc155deba97182399e7
[openwrt.git] / target / linux / adm5120 / patches / 203-gpio_leds_brightness.patch
1 --- a/drivers/leds/leds-gpio.c
2 +++ b/drivers/leds/leds-gpio.c
3 @@ -41,13 +41,17 @@
4 container_of(led_cdev, struct gpio_led_data, cdev);
5 int level;
6
7 - if (value == LED_OFF)
8 - level = 0;
9 - else
10 - level = 1;
11 -
12 - if (led_dat->active_low)
13 - level = !level;
14 + switch (value) {
15 + case LED_OFF:
16 + level = led_dat->active_low ? 1 : 0;
17 + break;
18 + case LED_FULL:
19 + level = led_dat->active_low ? 0 : 1;
20 + break;
21 + default:
22 + level = value;
23 + break;
24 + }
25
26 /* setting GPIOs with I2C/etc requires a preemptible task context */
27 if (led_dat->can_sleep) {
This page took 0.051036 seconds and 3 git commands to generate.