301-led_count.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --- a/arch/mips/bcm63xx/boards/board_common.c
  2. +++ b/arch/mips/bcm63xx/boards/board_common.c
  3. @@ -170,6 +170,7 @@ static struct platform_device bcm63xx_gp
  4. int __init board_register_devices(void)
  5. {
  6. int button_count = 0;
  7. + int led_count = 0;
  8. if (board.has_uart0)
  9. bcm63xx_uart_register(0);
  10. @@ -223,10 +224,16 @@ int __init board_register_devices(void)
  11. bcm63xx_flash_register();
  12. - bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
  13. - bcm63xx_led_data.leds = board.leds;
  14. + /* count number of LEDs defined by this device */
  15. + while (led_count < ARRAY_SIZE(board.leds) && board.leds[led_count].name)
  16. + led_count++;
  17. +
  18. + if (led_count) {
  19. + bcm63xx_led_data.num_leds = led_count;
  20. + bcm63xx_led_data.leds = board.leds;
  21. - platform_device_register(&bcm63xx_gpio_leds);
  22. + platform_device_register(&bcm63xx_gpio_leds);
  23. + }
  24. if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags)
  25. gpio_request_one(board.ephy_reset_gpio,
  26. --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
  27. +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
  28. @@ -47,7 +47,7 @@ struct board_info {
  29. struct bcm63xx_dsp_platform_data dsp;
  30. /* GPIO LEDs */
  31. - struct gpio_led leds[5];
  32. + struct gpio_led leds[14];
  33. /* Buttons */
  34. struct gpio_keys_button buttons[4];