0004-common-board_f-cosmetic-use-__weak-for-leds.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. From ea9b2d003712ae2c6158abb5c9f285f593e8fcb0 Mon Sep 17 00:00:00 2001
  2. From: Jeroen Hofstee <jeroen@myspectrum.nl>
  3. Date: Mon, 23 Jun 2014 23:20:19 +0200
  4. Subject: [PATCH 4/6] common: board_f: cosmetic use __weak for leds
  5. First of all this looks a lot better, but it also
  6. prevents a gcc warning (W=1), that the weak function
  7. has no previous prototype.
  8. cc: Simon Glass <sjg@chromium.org>
  9. Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
  10. Acked-by: Simon Glass <sjg@chromium.org>
  11. ---
  12. common/board_f.c | 29 ++++++++++-------------------
  13. include/status_led.h | 22 +++++++++++-----------
  14. 2 files changed, 21 insertions(+), 30 deletions(-)
  15. diff --git a/common/board_f.c b/common/board_f.c
  16. index 4ea4cb2..bdab38e 100644
  17. --- a/common/board_f.c
  18. +++ b/common/board_f.c
  19. @@ -37,6 +37,7 @@
  20. #include <os.h>
  21. #include <post.h>
  22. #include <spi.h>
  23. +#include <status_led.h>
  24. #include <trace.h>
  25. #include <watchdog.h>
  26. #include <asm/errno.h>
  27. @@ -78,25 +79,15 @@ DECLARE_GLOBAL_DATA_PTR;
  28. ************************************************************************
  29. * May be supplied by boards if desired
  30. */
  31. -inline void __coloured_LED_init(void) {}
  32. -void coloured_LED_init(void)
  33. - __attribute__((weak, alias("__coloured_LED_init")));
  34. -inline void __red_led_on(void) {}
  35. -void red_led_on(void) __attribute__((weak, alias("__red_led_on")));
  36. -inline void __red_led_off(void) {}
  37. -void red_led_off(void) __attribute__((weak, alias("__red_led_off")));
  38. -inline void __green_led_on(void) {}
  39. -void green_led_on(void) __attribute__((weak, alias("__green_led_on")));
  40. -inline void __green_led_off(void) {}
  41. -void green_led_off(void) __attribute__((weak, alias("__green_led_off")));
  42. -inline void __yellow_led_on(void) {}
  43. -void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on")));
  44. -inline void __yellow_led_off(void) {}
  45. -void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off")));
  46. -inline void __blue_led_on(void) {}
  47. -void blue_led_on(void) __attribute__((weak, alias("__blue_led_on")));
  48. -inline void __blue_led_off(void) {}
  49. -void blue_led_off(void) __attribute__((weak, alias("__blue_led_off")));
  50. +__weak void coloured_LED_init(void) {}
  51. +__weak void red_led_on(void) {}
  52. +__weak void red_led_off(void) {}
  53. +__weak void green_led_on(void) {}
  54. +__weak void green_led_off(void) {}
  55. +__weak void yellow_led_on(void) {}
  56. +__weak void yellow_led_off(void) {}
  57. +__weak void blue_led_on(void) {}
  58. +__weak void blue_led_off(void) {}
  59. /*
  60. * Why is gd allocated a register? Prior to reloc it might be better to
  61. diff --git a/include/status_led.h b/include/status_led.h
  62. index 0eb91b8..b8aaaf7 100644
  63. --- a/include/status_led.h
  64. +++ b/include/status_led.h
  65. @@ -272,19 +272,21 @@ extern void __led_set (led_id_t mask, int state);
  66. # include <asm/status_led.h>
  67. #endif
  68. +#endif /* CONFIG_STATUS_LED */
  69. +
  70. /*
  71. * Coloured LEDs API
  72. */
  73. #ifndef __ASSEMBLY__
  74. -extern void coloured_LED_init (void);
  75. -extern void red_led_on(void);
  76. -extern void red_led_off(void);
  77. -extern void green_led_on(void);
  78. -extern void green_led_off(void);
  79. -extern void yellow_led_on(void);
  80. -extern void yellow_led_off(void);
  81. -extern void blue_led_on(void);
  82. -extern void blue_led_off(void);
  83. +void coloured_LED_init(void);
  84. +void red_led_on(void);
  85. +void red_led_off(void);
  86. +void green_led_on(void);
  87. +void green_led_off(void);
  88. +void yellow_led_on(void);
  89. +void yellow_led_off(void);
  90. +void blue_led_on(void);
  91. +void blue_led_off(void);
  92. #else
  93. .extern LED_init
  94. .extern red_led_on
  95. @@ -297,6 +299,4 @@ extern void blue_led_off(void);
  96. .extern blue_led_off
  97. #endif
  98. -#endif /* CONFIG_STATUS_LED */
  99. -
  100. #endif /* _STATUS_LED_H_ */
  101. --
  102. 2.5.0