fix gpio_button device register
authorRaphaël Huck <rhk@cksum.org>
Thu, 29 Apr 2010 12:50:09 +0000 (12:50 +0000)
committerRaphaël Huck <rhk@cksum.org>
Thu, 29 Apr 2010 12:50:09 +0000 (12:50 +0000)
SVN-Revision: 21252

target/linux/brcm63xx/patches-2.6.32/100-reset_buttons.patch
target/linux/brcm63xx/patches-2.6.32/140-new_bcm96348gw_leds.patch
target/linux/brcm63xx/patches-2.6.33/100-reset_buttons.patch
target/linux/brcm63xx/patches-2.6.33/140-new_bcm96348gw_leds.patch

index 8c9bcc6dbe31779e48c09e97e567b22e93f9e595..71d8e4741fe2dc07540c781086212e5495b5db06 100644 (file)
@@ -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,
  };
  
  /*
   * 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);
index 3ec4199a3fec93f6a7d70abd1c18682198f409fd..d9dba14932f7819a00ccaa9fa7236104e699e48c 100644 (file)
  {
        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);
  
index e1faeeedaf847eeb8716be19762ce3fb451cde69..292e0a7cc94aa5bce8ebe06d60d6cb348b941690 100644 (file)
@@ -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,
  };
  
  /*
   * 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);
index f1a66c9f919d0a044805d70818c451c566b6dde3..292f196ac6b618084365fdb6177bcdb98701965d 100644 (file)
  {
        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);