[U-Boot] [PATCH v2 1/6] mtd: Fix function description in part_validate comment

The part_validate comment had a wrong description of the actions it does and referenced to non-existent functions while in fact it calls 'part_validate_eraseblock()'.
Signed-off-by: Otavio Salvador otavio@ossystems.com.br --- Changes in v2: - rework commit log (Eric Benard)
common/cmd_mtdparts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index 3023479..0104285 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -381,10 +381,10 @@ static int part_validate_eraseblock(struct mtdids *id, struct part_info *part)
/** - * Performs sanity check for supplied partition. Offset and size are verified - * to be within valid range. Partition type is checked and either - * parts_validate_nor() or parts_validate_nand() is called with the argument - * of part. + * Performs sanity check for supplied partition. Offset and size are + * verified to be within valid range. Partition type is checked and + * either part_validate_eraseblock() is called with the argument of + * part. * * @param id of the parent device * @param part partition to validate

The modelist data uses the list definition but the 'list.h' header were not being included. The build failure is bellow:
,---- | In file included from yyyy.c:16:0: | .../u-boot/include/linux/fb.h:503:19: error: field 'modelist' has incomplete type | struct list_head modelist; /* mode list */ | ^ | make[1]: *** [yyyy.o] Error 1 | make[1]: Leaving directory `.../u-boot/board/xxx/yyyy' | make: *** [board/xxx/yyyy/libyyyy.o] Error 2 `----
Signed-off-by: Otavio Salvador otavio@ossystems.com.br --- Changes in v2: - rework commitlog (Fabio)
include/linux/fb.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/linux/fb.h b/include/linux/fb.h index 3858f8f..111372c 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -2,6 +2,7 @@ #define _LINUX_FB_H
#include <linux/types.h> +#include <linux/list.h>
/* Definitions of frame buffers */

Signed-off-by: Otavio Salvador otavio@ossystems.com.br --- Changes in v2: None
doc/README.JFFS2_NAND | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/README.JFFS2_NAND b/doc/README.JFFS2_NAND index 5018ae8..09788d5 100644 --- a/doc/README.JFFS2_NAND +++ b/doc/README.JFFS2_NAND @@ -1,6 +1,6 @@ JFFS2 NAND support:
-To ebable, use the following #define in the board configuration file: +To enable, use the following #define in the board configuration file:
#define CONFIG_JFFS2_NAND 1

Signed-off-by: Otavio Salvador otavio@ossystems.com.br --- Changes in v2: - new patch
drivers/misc/status_led.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c index 6b71ad4..33148c9 100644 --- a/drivers/misc/status_led.c +++ b/drivers/misc/status_led.c @@ -94,9 +94,10 @@ void status_led_set (int led, int state) { led_dev_t *ld;
- if (led < 0 || led >= MAX_LED_DEV) + if (led < 0 || led >= MAX_LED_DEV) { + printf("ERROR: LED bit is out of range\n"); return; + }
if (!status_led_init_done) status_led_init ();

There're cases we want to use active-low LEDs and the 'inverted' logic needs to be added. This includes it using the STATUS_LED_INVERT macro.
Signed-off-by: Otavio Salvador otavio@ossystems.com.br --- Changes in v2: - rework to keep calling __led_init
doc/README.LED | 2 ++ drivers/misc/status_led.c | 22 ++++++++++++++++++++-- include/status_led.h | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/doc/README.LED b/doc/README.LED index c3bcb3a..c14555a 100644 --- a/doc/README.LED +++ b/doc/README.LED @@ -43,6 +43,8 @@ STATUS_LED_RED is the red LED. It is used signal errors. This must be a valid STATUS_LED_BIT value. Other similar color LED's are STATUS_LED_YELLOW and STATUS_LED_BLUE.
+STATUS_LED_INVERT and STATUS_LED_INVERT<n> to use active-low LEDs. + These board must define these functions
__led_init is called once to initialize the LED to STATUS_LED_STATE. One time diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c index 33148c9..ef0aa00 100644 --- a/drivers/misc/status_led.c +++ b/drivers/misc/status_led.c @@ -23,6 +23,7 @@ typedef struct { led_id_t mask; int state; int period; + int invert; int cnt; } led_dev_t;
@@ -30,12 +31,14 @@ led_dev_t led_dev[] = { { STATUS_LED_BIT, STATUS_LED_STATE, STATUS_LED_PERIOD, + STATUS_LED_INVERT, 0, }, #if defined(STATUS_LED_BIT1) { STATUS_LED_BIT1, STATUS_LED_STATE1, STATUS_LED_PERIOD1, + STATUS_LED_INVERT1, 0, }, #endif @@ -43,6 +46,7 @@ led_dev_t led_dev[] = { { STATUS_LED_BIT2, STATUS_LED_STATE2, STATUS_LED_PERIOD2, + STATUS_LED_INVERT2, 0, }, #endif @@ -50,6 +54,7 @@ led_dev_t led_dev[] = { { STATUS_LED_BIT3, STATUS_LED_STATE3, STATUS_LED_PERIOD3, + STATUS_LED_INVERT3, 0, }, #endif @@ -59,13 +64,26 @@ led_dev_t led_dev[] = {
static int status_led_init_done = 0;
+static int led_state_value(led_dev_t *ld, int state) +{ + if (ld->invert) { + if (state == STATUS_LED_ON) + state = STATUS_LED_OFF; + else if (state == STATUS_LED_OFF) + state = STATUS_LED_ON; + } + + return state; +} + static void status_led_init (void) { led_dev_t *ld; int i;
for (i = 0, ld = led_dev; i < MAX_LED_DEV; i++, ld++) - __led_init (ld->mask, ld->state); + __led_init (ld->mask, led_state_value(ld, ld->state)); + status_led_init_done = 1; }
@@ -109,5 +127,5 @@ void status_led_set (int led, int state) ld->cnt = 0; /* always start with full period */ state = STATUS_LED_ON; /* always start with LED _ON_ */ } - __led_set (ld->mask, state); + __led_set (ld->mask, led_state_value(ld, state)); } diff --git a/include/status_led.h b/include/status_led.h index ecff60d..0da3fda 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -288,6 +288,20 @@ extern void __led_set (led_id_t mask, int state); #else # error Status LED configuration missing #endif + +#ifndef STATUS_LED_INVERT +#define STATUS_LED_INVERT 0 +#endif +#ifndef STATUS_LED_INVERT1 +#define STATUS_LED_INVERT1 0 +#endif +#ifndef STATUS_LED_INVERT2 +#define STATUS_LED_INVERT2 0 +#endif +#ifndef STATUS_LED_INVERT3 +#define STATUS_LED_INVERT3 0 +#endif + /************************************************************************/
#ifndef CONFIG_BOARD_SPECIFIC_LED

Signed-off-by: Otavio Salvador otavio@ossystems.com.br --- Changes in v2: None
common/cmd_led.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/common/cmd_led.c b/common/cmd_led.c index c48603c..d541f2f 100644 --- a/common/cmd_led.c +++ b/common/cmd_led.c @@ -18,6 +18,7 @@ struct led_tbl_s { char *string; /* String for use in the command */ led_id_t mask; /* Mask used for calling __led_set() */ + int invert; /* Is the LED inverted? */ void (*off)(void); /* Optional function for turning LED off */ void (*on)(void); /* Optional function for turning LED on */ void (*toggle)(void);/* Optional function for toggling LED */ @@ -28,31 +29,31 @@ typedef struct led_tbl_s led_tbl_t; static const led_tbl_t led_commands[] = { #ifdef CONFIG_BOARD_SPECIFIC_LED #ifdef STATUS_LED_BIT - { "0", STATUS_LED_BIT, NULL, NULL, NULL }, + { "0", STATUS_LED_BIT, STATUS_LED_INVERT, NULL, NULL, NULL }, #endif #ifdef STATUS_LED_BIT1 - { "1", STATUS_LED_BIT1, NULL, NULL, NULL }, + { "1", STATUS_LED_BIT1, STATUS_LED_INVERT1, NULL, NULL, NULL }, #endif #ifdef STATUS_LED_BIT2 - { "2", STATUS_LED_BIT2, NULL, NULL, NULL }, + { "2", STATUS_LED_BIT2, STATUS_LED_INVERT2, NULL, NULL, NULL }, #endif #ifdef STATUS_LED_BIT3 - { "3", STATUS_LED_BIT3, NULL, NULL, NULL }, + { "3", STATUS_LED_BIT3, STATUS_LED_INVERT3, NULL, NULL, NULL }, #endif #endif #ifdef STATUS_LED_GREEN - { "green", STATUS_LED_GREEN, green_led_off, green_led_on, NULL }, + { "green", STATUS_LED_GREEN, 0, green_led_off, green_led_on, NULL }, #endif #ifdef STATUS_LED_YELLOW - { "yellow", STATUS_LED_YELLOW, yellow_led_off, yellow_led_on, NULL }, + { "yellow", STATUS_LED_YELLOW, 0, yellow_led_off, yellow_led_on, NULL }, #endif #ifdef STATUS_LED_RED - { "red", STATUS_LED_RED, red_led_off, red_led_on, NULL }, + { "red", STATUS_LED_RED, 0, red_led_off, red_led_on, NULL }, #endif #ifdef STATUS_LED_BLUE - { "blue", STATUS_LED_BLUE, blue_led_off, blue_led_on, NULL }, + { "blue", STATUS_LED_BLUE, 0, blue_led_off, blue_led_on, NULL }, #endif - { NULL, 0, NULL, NULL, NULL } + { NULL, 0, 0, NULL, NULL, NULL } };
enum led_cmd { LED_ON, LED_OFF, LED_TOGGLE }; @@ -95,14 +96,18 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) led_commands[i].on(); else __led_set(led_commands[i].mask, - STATUS_LED_ON); + (led_commands[i].invert + ? STATUS_LED_OFF + : STATUS_LED_ON)); break; case LED_OFF: if (led_commands[i].off) led_commands[i].off(); else __led_set(led_commands[i].mask, - STATUS_LED_OFF); + (led_commands[i].invert + ? STATUS_LED_ON + : STATUS_LED_OFF)); break; case LED_TOGGLE: if (led_commands[i].toggle)
participants (1)
-
Otavio Salvador