diff options
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/0124-leds-gpio-broken-with-current-git.patch')
-rw-r--r-- | meta/recipes-kernel/linux/linux-omap-2.6.29/0124-leds-gpio-broken-with-current-git.patch | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/0124-leds-gpio-broken-with-current-git.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/0124-leds-gpio-broken-with-current-git.patch new file mode 100644 index 0000000000..dc6e190e89 --- /dev/null +++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/0124-leds-gpio-broken-with-current-git.patch | |||
@@ -0,0 +1,79 @@ | |||
1 | From c810e850d830330cf04225a4cff8e981e153f269 Mon Sep 17 00:00:00 2001 | ||
2 | From: David Brownell <david-b@pacbell.net> | ||
3 | Date: Mon, 23 Feb 2009 14:08:14 -0800 | ||
4 | Subject: [PATCH 124/133] leds-gpio broken with current git? | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=utf-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | On Monday 23 February 2009, David Brownell wrote: | ||
10 | > | ||
11 | > > Perhaps something broke with Tony's RC1 merge? | ||
12 | > > The LEDs are broken for me as well. | ||
13 | > | ||
14 | > Still works for me. Â Did you maybe not enable the twl4030 | ||
15 | > GPIO support in Kconfig? | ||
16 | |||
17 | Oh, and if you did *not*, please give this patch a try. | ||
18 | I've been meaning to test it. | ||
19 | |||
20 | - Dave | ||
21 | |||
22 | ============== | ||
23 | Sometimes it's awkward to make sure that the array in the | ||
24 | platform_data handed to the leds-gpio driver has only valid | ||
25 | data ... some leds may not be always available, and coping | ||
26 | with that currently requires patching or rebuilding the array. | ||
27 | |||
28 | This patch fixes that by making it be OK to pass an invalid | ||
29 | GPIO (such as "-EINVAL") ... such table entries are skipped. | ||
30 | --- | ||
31 | drivers/leds/leds-gpio.c | 12 +++++++++++- | ||
32 | 1 files changed, 11 insertions(+), 1 deletions(-) | ||
33 | |||
34 | diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c | ||
35 | index b13bd29..83737e6 100644 | ||
36 | --- a/drivers/leds/leds-gpio.c | ||
37 | +++ b/drivers/leds/leds-gpio.c | ||
38 | @@ -90,13 +90,19 @@ static int gpio_led_probe(struct platform_device *pdev) | ||
39 | cur_led = &pdata->leds[i]; | ||
40 | led_dat = &leds_data[i]; | ||
41 | |||
42 | + /* skip leds that aren't available */ | ||
43 | + led_dat->gpio = cur_led->gpio; | ||
44 | + if (!gpio_is_valid(led_dat->gpio)) { | ||
45 | + dev_dbg(&pdev->dev, "skipping %s\n", cur_led->name); | ||
46 | + continue; | ||
47 | + } | ||
48 | + | ||
49 | ret = gpio_request(cur_led->gpio, cur_led->name); | ||
50 | if (ret < 0) | ||
51 | goto err; | ||
52 | |||
53 | led_dat->cdev.name = cur_led->name; | ||
54 | led_dat->cdev.default_trigger = cur_led->default_trigger; | ||
55 | - led_dat->gpio = cur_led->gpio; | ||
56 | led_dat->can_sleep = gpio_cansleep(cur_led->gpio); | ||
57 | led_dat->active_low = cur_led->active_low; | ||
58 | if (pdata->gpio_blink_set) { | ||
59 | @@ -124,6 +130,8 @@ static int gpio_led_probe(struct platform_device *pdev) | ||
60 | err: | ||
61 | if (i > 0) { | ||
62 | for (i = i - 1; i >= 0; i--) { | ||
63 | + if (!gpio_is_valid(leds_data[i].gpio)) | ||
64 | + continue; | ||
65 | led_classdev_unregister(&leds_data[i].cdev); | ||
66 | cancel_work_sync(&leds_data[i].work); | ||
67 | gpio_free(leds_data[i].gpio); | ||
68 | @@ -144,6 +152,8 @@ static int __devexit gpio_led_remove(struct platform_device *pdev) | ||
69 | leds_data = platform_get_drvdata(pdev); | ||
70 | |||
71 | for (i = 0; i < pdata->num_leds; i++) { | ||
72 | + if (!gpio_is_valid(leds_data[i].gpio)) | ||
73 | + continue; | ||
74 | led_classdev_unregister(&leds_data[i].cdev); | ||
75 | cancel_work_sync(&leds_data[i].work); | ||
76 | gpio_free(leds_data[i].gpio); | ||
77 | -- | ||
78 | 1.6.0.4.790.gaa14a | ||
79 | |||