aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaphaël HUCK <rhk@cksum.org>2010-04-29 12:50:09 +0000
committerRaphaël HUCK <rhk@cksum.org>2010-04-29 12:50:09 +0000
commit7e2975d848d68bd9d5017c63e9273bfd2c62a9c1 (patch)
tree69ab0fab3905f05284d25c67549590828b79d04e
parent0a512ce142d076578a7d67ddaaee5af341c6754a (diff)
downloadupstream-7e2975d848d68bd9d5017c63e9273bfd2c62a9c1.tar.gz
upstream-7e2975d848d68bd9d5017c63e9273bfd2c62a9c1.tar.bz2
upstream-7e2975d848d68bd9d5017c63e9273bfd2c62a9c1.zip
[brcm63xx] fix gpio_button device register
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21252 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/brcm63xx/patches-2.6.32/100-reset_buttons.patch19
-rw-r--r--target/linux/brcm63xx/patches-2.6.32/140-new_bcm96348gw_leds.patch4
-rw-r--r--target/linux/brcm63xx/patches-2.6.33/100-reset_buttons.patch19
-rw-r--r--target/linux/brcm63xx/patches-2.6.33/140-new_bcm96348gw_leds.patch4
4 files changed, 34 insertions, 12 deletions
diff --git a/target/linux/brcm63xx/patches-2.6.32/100-reset_buttons.patch b/target/linux/brcm63xx/patches-2.6.32/100-reset_buttons.patch
index 8c9bcc6dbe..71d8e4741f 100644
--- a/target/linux/brcm63xx/patches-2.6.32/100-reset_buttons.patch
+++ b/target/linux/brcm63xx/patches-2.6.32/100-reset_buttons.patch
@@ -43,7 +43,7 @@
};
static struct board_info __initdata board_FAST2404 = {
-@@ -771,6 +793,16 @@ static struct platform_device bcm63xx_gp
+@@ -771,12 +793,23 @@ static struct platform_device bcm63xx_gp
.dev.platform_data = &bcm63xx_led_data,
};
@@ -60,12 +60,23 @@
/*
* third stage init callback, register all board devices.
*/
-@@ -826,6 +858,13 @@ int __init board_register_devices(void)
+ int __init board_register_devices(void)
+ {
+ u32 val;
++ int button_count = 0;
+
+ if (board.has_pccard)
+ bcm63xx_pcmcia_register();
+@@ -826,6 +859,17 @@ int __init board_register_devices(void)
platform_device_register(&bcm63xx_gpio_leds);
-+ if (board.reset_buttons) {
-+ bcm63xx_gpio_buttons_data.nbuttons = ARRAY_SIZE(board.reset_buttons);
++ /* count number of BUTTONs defined by this device */
++ while (button_count < ARRAY_SIZE(board.reset_buttons) && board.reset_buttons[button_count].desc)
++ button_count++;
++
++ if (button_count) {
++ bcm63xx_gpio_buttons_data.nbuttons = button_count;
+ bcm63xx_gpio_buttons_data.buttons = board.reset_buttons;
+
+ platform_device_register(&bcm63xx_gpio_buttons_device);
diff --git a/target/linux/brcm63xx/patches-2.6.32/140-new_bcm96348gw_leds.patch b/target/linux/brcm63xx/patches-2.6.32/140-new_bcm96348gw_leds.patch
index 3ec4199a3f..d9dba14932 100644
--- a/target/linux/brcm63xx/patches-2.6.32/140-new_bcm96348gw_leds.patch
+++ b/target/linux/brcm63xx/patches-2.6.32/140-new_bcm96348gw_leds.patch
@@ -53,10 +53,10 @@
{
u32 val;
+ int led_count = 0;
+ int button_count = 0;
if (board.has_pccard)
- bcm63xx_pcmcia_register();
-@@ -901,7 +917,11 @@ int __init board_register_devices(void)
+@@ -902,7 +918,11 @@ int __init board_register_devices(void)
platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1);
diff --git a/target/linux/brcm63xx/patches-2.6.33/100-reset_buttons.patch b/target/linux/brcm63xx/patches-2.6.33/100-reset_buttons.patch
index e1faeeedaf..292e0a7cc9 100644
--- a/target/linux/brcm63xx/patches-2.6.33/100-reset_buttons.patch
+++ b/target/linux/brcm63xx/patches-2.6.33/100-reset_buttons.patch
@@ -43,7 +43,7 @@
};
static struct board_info __initdata board_FAST2404 = {
-@@ -770,6 +792,16 @@ static struct platform_device bcm63xx_gp
+@@ -770,12 +792,23 @@ static struct platform_device bcm63xx_gp
.dev.platform_data = &bcm63xx_led_data,
};
@@ -60,12 +60,23 @@
/*
* third stage init callback, register all board devices.
*/
-@@ -825,6 +857,13 @@ int __init board_register_devices(void)
+ int __init board_register_devices(void)
+ {
+ u32 val;
++ int button_count = 0;
+
+ if (board.has_pccard)
+ bcm63xx_pcmcia_register();
+@@ -825,6 +858,17 @@ int __init board_register_devices(void)
platform_device_register(&bcm63xx_gpio_leds);
-+ if (board.reset_buttons) {
-+ bcm63xx_gpio_buttons_data.nbuttons = ARRAY_SIZE(board.reset_buttons);
++ /* count number of BUTTONs defined by this device */
++ while (button_count < ARRAY_SIZE(board.reset_buttons) && board.reset_buttons[button_count].desc)
++ button_count++;
++
++ if (button_count) {
++ bcm63xx_gpio_buttons_data.nbuttons = button_count;
+ bcm63xx_gpio_buttons_data.buttons = board.reset_buttons;
+
+ platform_device_register(&bcm63xx_gpio_buttons_device);
diff --git a/target/linux/brcm63xx/patches-2.6.33/140-new_bcm96348gw_leds.patch b/target/linux/brcm63xx/patches-2.6.33/140-new_bcm96348gw_leds.patch
index f1a66c9f91..292f196ac6 100644
--- a/target/linux/brcm63xx/patches-2.6.33/140-new_bcm96348gw_leds.patch
+++ b/target/linux/brcm63xx/patches-2.6.33/140-new_bcm96348gw_leds.patch
@@ -53,10 +53,10 @@
{
u32 val;
+ int led_count = 0;
+ int button_count = 0;
if (board.has_pccard)
- bcm63xx_pcmcia_register();
-@@ -900,7 +916,11 @@ int __init board_register_devices(void)
+@@ -901,7 +917,11 @@ int __init board_register_devices(void)
platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1);