[U-Boot] [PATCH14/23] GPIO/LED: make more robust, if STATUS_LED isn't selected

Benjamin Tietz uboot at dresden.micronet24.de
Sat Jun 18 14:56:36 CEST 2016


From: Benjamin Tietz <benjamin at micronet24.de>


---
 drivers/misc/gpio_led.c   |    4 ++++
 drivers/misc/status_led.c |    2 ++
 include/status_led.h      |    4 ++++
 3 files changed, 10 insertions(+)
-------------- next part --------------
From: Benjamin Tietz <benjamin at micronet24.de>


---
 drivers/misc/gpio_led.c   |    4 ++++
 drivers/misc/status_led.c |    2 ++
 include/status_led.h      |    4 ++++
 3 files changed, 10 insertions(+)

diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
index 164c30d..9c0ea13 100644
--- a/drivers/misc/gpio_led.c
+++ b/drivers/misc/gpio_led.c
@@ -13,6 +13,10 @@
 #define CONFIG_GPIO_LED_INVERTED_TABLE {}
 #endif
 
+#ifndef STATUS_LED_ON
+#define STATUS_LED_ON 2
+#endif
+
 static led_id_t gpio_led_inv[] = CONFIG_GPIO_LED_INVERTED_TABLE;
 
 static int gpio_led_gpio_value(led_id_t mask, int state)
diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c
index 31e8831..052ecf0 100644
--- a/drivers/misc/status_led.c
+++ b/drivers/misc/status_led.c
@@ -27,11 +27,13 @@ typedef struct {
 } led_dev_t;
 
 led_dev_t led_dev[] = {
+#if defined(STATUS_LED_BIT)
     {	STATUS_LED_BIT,
 	STATUS_LED_STATE,
 	STATUS_LED_PERIOD,
 	0,
     },
+#endif
 #if defined(STATUS_LED_BIT1)
     {	STATUS_LED_BIT1,
 	STATUS_LED_STATE1,
diff --git a/include/status_led.h b/include/status_led.h
index 396ea88..2185855 100644
--- a/include/status_led.h
+++ b/include/status_led.h
@@ -103,6 +103,10 @@ void __led_blink(led_id_t mask, int freq);
 # include <asm/status_led.h>
 #endif
 
+#else
+
+typedef int led_id_t;
+
 #endif	/* CONFIG_STATUS_LED	*/
 
 /*


More information about the U-Boot mailing list