[U-Boot] [PATCH] make hang() a weak function

Stefan Roese sr at denx.de
Tue Apr 16 12:29:26 CEST 2013


Hi Andreas,

On 16.04.2013 12:14, Andreas Bießmann wrote:
> This patch also does some minor coding style cleanups.
> 
> Signed-off-by: Andreas Bießmann <andreas.devel at googlemail.com>
> 
> ---
>  arch/arm/lib/board.c            |    3 ++-
>  arch/avr32/lib/board.c          |    3 ++-
>  arch/blackfin/lib/board.c       |    3 ++-
>  arch/m68k/lib/board.c           |    3 ++-
>  arch/microblaze/lib/board.c     |    5 +++--
>  arch/mips/lib/board.c           |    3 ++-
>  arch/nds32/lib/board.c          |    3 ++-
>  arch/nios2/lib/board.c          |    5 +++--
>  arch/openrisc/lib/board.c       |    3 ++-
>  arch/powerpc/lib/board.c        |    4 ++--
>  arch/sandbox/lib/board.c        |    3 ++-
>  arch/sh/lib/board.c             |    3 ++-
>  arch/sparc/lib/board.c          |    3 ++-
>  arch/x86/lib/board.c            |    3 ++-
>  common/board_f.c                |    3 ++-
>  common/spl/spl.c                |    3 ++-
>  drivers/mtd/nand/mxc_nand_spl.c |    3 ++-
>  17 files changed, 36 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index 0521178..4a00e16 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -707,8 +707,9 @@ void board_init_r(gd_t *id, ulong dest_addr)
>  	/* NOTREACHED - no way out of command loop except booting */
>  }
>  
> -void hang(void)
> +void __hang(void)
>  {
>  	puts("### ERROR ### Please RESET the board ###\n");
>  	for (;;);
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));

Please include "linux/compiler.h" and use:

void __weak hang(void)
{
	puts("### ERROR ### Please RESET the board ###\n");
	for (;;);
}

instead. No __attribute__ needed and easier to read.

Thanks,
Stefan



More information about the U-Boot mailing list