ac16e9b6dccea8c625b6b004666715d0eb859642
[oweals/openwrt.git] / target / linux / adm5120 / patches-3.8 / 203-gpio_leds_brightness.patch
1 --- a/drivers/leds/leds-gpio.c
2 +++ b/drivers/leds/leds-gpio.c
3 @@ -56,13 +56,17 @@ static void gpio_led_set(struct led_clas
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