Skip to content
Snippets Groups Projects
Commit bd2a23ac authored by Igor Grinberg's avatar Igor Grinberg Committed by Stefano Babic
Browse files

env: clean env_embedded.c checkpatch and code style


Cleanup the env_embedded.c checkpatch warnings, errors and coding style.
There is one error left though:
 ERROR: Macros with multiple statements should be enclosed in a do - while loop
 #79: FILE: u-boot/common/env_embedded.c:79:
 +#define GEN_ABS(name, value)                   \
 +       asm(".globl " GEN_SYMNAME(name));       \
 +       GEN_SET_VALUE(name, value)

 total: 1 errors, 0 warnings, 213 lines checked

We cannot enclose that statement in a do - while loop,
because these are a global assembly declarations.

Signed-off-by: default avatarIgor Grinberg <grinberg@compulab.co.il>
parent e8db8f71
No related branches found
No related tags found
No related merge requests found
...@@ -22,17 +22,14 @@ ...@@ -22,17 +22,14 @@
*/ */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#define __ASSEMBLY__ /* Dirty trick to get only #defines */ #define __ASSEMBLY__ /* Dirty trick to get only #defines */
#endif #endif
#define __ASM_STUB_PROCESSOR_H__ /* don't include asm/processor. */ #define __ASM_STUB_PROCESSOR_H__ /* don't include asm/processor. */
#include <config.h> #include <config.h>
#undef __ASSEMBLY__ #undef __ASSEMBLY__
#include <environment.h> #include <environment.h>
/* /* Handle HOSTS that have prepended crap on symbol names, not TARGETS. */
* Handle HOSTS that have prepended
* crap on symbol names, not TARGETS.
*/
#if defined(__APPLE__) #if defined(__APPLE__)
/* Leading underscore on symbols */ /* Leading underscore on symbols */
# define SYM_CHAR "_" # define SYM_CHAR "_"
...@@ -52,34 +49,36 @@ ...@@ -52,34 +49,36 @@
* U-Boot itself. * U-Boot itself.
*/ */
#if (defined(CONFIG_SYS_USE_PPCENV) || defined(CONFIG_NAND_U_BOOT)) && \ #if (defined(CONFIG_SYS_USE_PPCENV) || defined(CONFIG_NAND_U_BOOT)) && \
defined(ENV_CRC) /* Environment embedded in U-Boot .ppcenv section */ defined(ENV_CRC) /* Environment embedded in U-Boot .ppcenv section */
/* XXX - This only works with GNU C */ /* XXX - This only works with GNU C */
# define __PPCENV__ __attribute__ ((section(".ppcenv"))) # define __PPCENV__ __attribute__ ((section(".ppcenv")))
# define __PPCTEXT__ __attribute__ ((section(".text"))) # define __PPCTEXT__ __attribute__ ((section(".text")))
#elif defined(USE_HOSTCC) /* Native for 'tools/envcrc' */ #elif defined(USE_HOSTCC) /* Native for 'tools/envcrc' */
# define __PPCENV__ /*XXX DO_NOT_DEL_THIS_COMMENT*/ # define __PPCENV__ /*XXX DO_NOT_DEL_THIS_COMMENT*/
# define __PPCTEXT__ /*XXX DO_NOT_DEL_THIS_COMMENT*/ # define __PPCTEXT__ /*XXX DO_NOT_DEL_THIS_COMMENT*/
#else /* Environment is embedded in U-Boot's .text section */ #else /* Environment is embedded in U-Boot's .text section */
/* XXX - This only works with GNU C */ /* XXX - This only works with GNU C */
# define __PPCENV__ __attribute__ ((section(".text"))) # define __PPCENV__ __attribute__ ((section(".text")))
# define __PPCTEXT__ __attribute__ ((section(".text"))) # define __PPCTEXT__ __attribute__ ((section(".text")))
#endif #endif
/* /*
* Macros to generate global absolutes. * Macros to generate global absolutes.
*/ */
#if defined(__bfin__) #if defined(__bfin__)
# define GEN_SET_VALUE(name, value) asm (".set " GEN_SYMNAME(name) ", " GEN_VALUE(value)) # define GEN_SET_VALUE(name, value) \
asm(".set " GEN_SYMNAME(name) ", " GEN_VALUE(value))
#else #else
# define GEN_SET_VALUE(name, value) asm (GEN_SYMNAME(name) " = " GEN_VALUE(value)) # define GEN_SET_VALUE(name, value) \
#endif asm(GEN_SYMNAME(name) " = " GEN_VALUE(value))
#define GEN_SYMNAME(str) SYM_CHAR #str #endif
#define GEN_VALUE(str) #str #define GEN_SYMNAME(str) SYM_CHAR #str
#define GEN_ABS(name, value) \ #define GEN_VALUE(str) #str
asm (".globl " GEN_SYMNAME(name)); \ #define GEN_ABS(name, value) \
GEN_SET_VALUE(name, value) asm(".globl " GEN_SYMNAME(name)); \
GEN_SET_VALUE(name, value)
/* /*
* Macros to transform values * Macros to transform values
...@@ -93,7 +92,7 @@ ...@@ -93,7 +92,7 @@
* computed CRC. Otherwise define it as ~0. * computed CRC. Otherwise define it as ~0.
*/ */
#if !defined(ENV_CRC) #if !defined(ENV_CRC)
# define ENV_CRC ~0 # define ENV_CRC (~0)
#endif #endif
env_t environment __PPCENV__ = { env_t environment __PPCENV__ = {
...@@ -151,7 +150,7 @@ env_t environment __PPCENV__ = { ...@@ -151,7 +150,7 @@ env_t environment __PPCENV__ = {
"serverip=" MK_STR(CONFIG_SERVERIP) "\0" "serverip=" MK_STR(CONFIG_SERVERIP) "\0"
#endif #endif
#ifdef CONFIG_SYS_AUTOLOAD #ifdef CONFIG_SYS_AUTOLOAD
"autoload=" CONFIG_SYS_AUTOLOAD "\0" "autoload=" CONFIG_SYS_AUTOLOAD "\0"
#endif #endif
#ifdef CONFIG_ROOTPATH #ifdef CONFIG_ROOTPATH
"rootpath=" CONFIG_ROOTPATH "\0" "rootpath=" CONFIG_ROOTPATH "\0"
...@@ -180,7 +179,7 @@ env_t environment __PPCENV__ = { ...@@ -180,7 +179,7 @@ env_t environment __PPCENV__ = {
#if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0) #if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0)
"pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0" "pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0"
#endif #endif
#ifdef CONFIG_EXTRA_ENV_SETTINGS #ifdef CONFIG_EXTRA_ENV_SETTINGS
CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_SETTINGS
#endif #endif
"\0" /* Term. env_t.data with 2 NULs */ "\0" /* Term. env_t.data with 2 NULs */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment