Code clean up of cmd_nvedit.c by using checkpatch.pl.
Signed-off-by: Macpaul Lin
---
Changes for v2:
- Replace the ident characters for #ifdef from space to tab.
Changes for v3:
- fix for commit 31e41398, "Fix typo in #error: IS_IN_NOWHERE vs. IS_NOWHERE"
common/cmd_nvedit.c | 148 +--
1 files changed, 73 insertions(+), 75 deletions(-)
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index df0e6db..c45af56 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -54,16 +54,16 @@
DECLARE_GLOBAL_DATA_PTR;
-#if !defined(CONFIG_ENV_IS_IN_EEPROM) && \
-!defined(CONFIG_ENV_IS_IN_FLASH) && \
-!defined(CONFIG_ENV_IS_IN_DATAFLASH) && \
-!defined(CONFIG_ENV_IS_IN_MG_DISK) && \
-!defined(CONFIG_ENV_IS_IN_MMC) && \
-!defined(CONFIG_ENV_IS_IN_NAND)&& \
-!defined(CONFIG_ENV_IS_IN_NVRAM) && \
-!defined(CONFIG_ENV_IS_IN_ONENAND) && \
-!defined(CONFIG_ENV_IS_IN_SPI_FLASH) && \
-!defined(CONFIG_ENV_IS_NOWHERE)
+#if!defined(CONFIG_ENV_IS_IN_EEPROM) && \
+ !defined(CONFIG_ENV_IS_IN_FLASH)&& \
+ !defined(CONFIG_ENV_IS_IN_DATAFLASH)&& \
+ !defined(CONFIG_ENV_IS_IN_MG_DISK) && \
+ !defined(CONFIG_ENV_IS_IN_MMC) && \
+ !defined(CONFIG_ENV_IS_IN_NAND) && \
+ !defined(CONFIG_ENV_IS_IN_NVRAM)&& \
+ !defined(CONFIG_ENV_IS_IN_ONENAND) && \
+ !defined(CONFIG_ENV_IS_IN_SPI_FLASH)&& \
+ !defined(CONFIG_ENV_IS_NOWHERE)
# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
SPI_FLASH|MG_DISK|NVRAM|MMC} or CONFIG_ENV_IS_NOWHERE
#endif
@@ -93,7 +93,7 @@ static const unsigned long baudrate_table[] =
CONFIG_SYS_BAUDRATE_TABLE;
*/
static int env_id = 1;
-int get_env_id (void)
+int get_env_id(void)
{
return env_id;
}
@@ -116,7 +116,7 @@ static int env_print(char *name)
hsearch_r(e, FIND, &ep, &env_htab);
if (ep == NULL)
return 0;
- len = printf ("%s=%s\n", ep->key, ep->data);
+ len = printf("%s=%s\n", ep->key, ep->data);
return len;
}
@@ -176,7 +176,7 @@ int _do_env_set (int flag, int argc, char * const argv[])
name = argv[1];
if (strchr(name, '=')) {
- printf ("## Error: illegal character '=' in variable name
\"%s\"\n", name);
+ printf("## Error: illegal character '=' in variable name
\"%s\"\n", name);
return 1;
}
@@ -189,13 +189,12 @@ int _do_env_set (int flag, int argc, char * const argv[])
hsearch_r(e, FIND, &ep, &env_htab);
/* Check for console redirection */
- if (strcmp(name,"stdin") == 0) {
+ if (strcmp(name, "stdin") == 0)
console = stdin;
- } else if (strcmp(name,"stdout") == 0) {
+ else if (strcmp(name, "stdout") == 0)
console = stdout;
- } else if (strcmp(name,"stderr") == 0) {
+ else if (strcmp(name, "stderr") == 0)
console = stderr;
- }
if (console != -1) {
if (argc < 3) { /* Cannot delete it! */
@@ -209,11 +208,11 @@ int _do_env_set (int flag, int argc, char * const argv[])
return i;
#else
/* Try assigning specified device */
- if (console_assign (console, argv[2]) < 0)
+ if (console_assign(console, argv[2]) < 0)
return 1;
#ifdef CONFIG_SERIAL_MULTI
- if (serial_assign (argv[2]) < 0)
+ if (serial_assign(argv[2]) < 0)
return 1;
#endif
#endif /* CONFIG_CONSOLE_MUX */
@@ -225,28 +224,28 @@ int _do_env_set (int flag, int argc, char * const argv[])
*/
if (ep) { /* variable exists */
#ifndef CONFIG_ENV_OVERWRITE
- if ((strcmp (name, "serial#") == 0) ||
- ((strcmp (name, "ethaddr") == 0)
+ if ((strcmp(name, "serial#") == 0) ||
+ ((strcmp(name, "ethaddr") == 0)
#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
-&& (strcmp (ep->data,MK_STR(CONFIG_ETHADDR)) != 0)
+&& (strcmp(ep->data, MK_STR(CONFIG_ETHADDR)) != 0)
#endif /* CONFIG_OVERWRITE_ETHADDR_ONCE && CONFIG_ETHADDR */
) ) {
- printf ("Can't overwrite \"%s\"\n", name);
+ printf("Can't overwrite \"%s\"\n", name);
return 1;
}
#endif
/*
* Switch to new baudrate if new baudrate is supported
*/
- if (strcmp(name,"baudrate") == 0) {
+ if (strcmp(name, "baudrate") == 0) {
int baudrate = simple_strtoul(argv[2], NULL, 10);
int i;
- for (i=0; ibd-