06394da295b935286299fec7722cb2dc6ac52e28
[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 task context, and we don't
27 * seem to have a reliable way to know if we're already in one; so
This page took 0.044058 seconds and 3 git commands to generate.