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