All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] make hang() a weak function
Date: Tue, 16 Apr 2013 13:36:21 +0200	[thread overview]
Message-ID: <20130416133621.40db0a42@lilith> (raw)
In-Reply-To: <1366107249-24547-1-git-send-email-andreas.devel@googlemail.com>

Hi Andreas,

On Tue, 16 Apr 2013 12:14:09 +0200, Andreas Bie?mann
<andreas.devel@googlemail.com> wrote:

> This patch also does some minor coding style cleanups.
> 
> Signed-off-by: Andreas Bie?mann <andreas.devel@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")));
> diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
> index 57e07df..7e3380a 100644
> --- a/arch/avr32/lib/board.c
> +++ b/arch/avr32/lib/board.c
> @@ -120,10 +120,11 @@ static int display_banner (void)
>  	return 0;
>  }
>  
> -void hang(void)
> +void __hang(void)
>  {
>  	for (;;) ;
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));
>  
>  static int display_dram_config (void)
>  {
> diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
> index 75b6c46..7769962 100644
> --- a/arch/blackfin/lib/board.c
> +++ b/arch/blackfin/lib/board.c
> @@ -433,7 +433,7 @@ void board_init_r(gd_t * id, ulong dest_addr)
>  		main_loop();
>  }
>  
> -void hang(void)
> +void __hang(void)
>  {
>  #ifdef CONFIG_STATUS_LED
>  	status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF);
> @@ -446,3 +446,4 @@ void hang(void)
>  		 */
>  		asm("emuexcpt;");
>  }
> +void hang(void) __attribute__((weak, alias("__hang"));
> diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c
> index adaccfe..93aeafb 100644
> --- a/arch/m68k/lib/board.c
> +++ b/arch/m68k/lib/board.c
> @@ -665,8 +665,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
>  }
>  
>  
> -void hang(void)
> +void __hang(void)
>  {
>  	puts ("### ERROR ### Please RESET the board ###\n");
>  	for (;;);
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index a7c2f76..e661704 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -195,8 +195,9 @@ void board_init_f(ulong not_used)
>  	}
>  }
>  
> -void hang (void)
> +void __hang(void)
>  {
> -	puts ("### ERROR ### Please RESET the board ###\n");
> +	puts("### ERROR ### Please RESET the board ###\n");
>  	for (;;) ;
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));
> diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c
> index f19f198..ad18440 100644
> --- a/arch/mips/lib/board.c
> +++ b/arch/mips/lib/board.c
> @@ -345,9 +345,10 @@ 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")));
> diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c
> index a7d27fc..2433d8a 100644
> --- a/arch/nds32/lib/board.c
> +++ b/arch/nds32/lib/board.c
> @@ -405,9 +405,10 @@ 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")));
> diff --git a/arch/nios2/lib/board.c b/arch/nios2/lib/board.c
> index 1e495d4..517a3a1 100644
> --- a/arch/nios2/lib/board.c
> +++ b/arch/nios2/lib/board.c
> @@ -168,9 +168,10 @@ void board_init (void)
>  
>  /***********************************************************************/
>  
> -void hang (void)
> +void __hang(void)
>  {
> -	disable_interrupts ();
> +	disable_interrupts();
>  	puts("### ERROR ### Please reset board ###\n");
>  	for (;;);
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));
> diff --git a/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c
> index 85aa189..c5437db 100644
> --- a/arch/openrisc/lib/board.c
> +++ b/arch/openrisc/lib/board.c
> @@ -158,7 +158,7 @@ void board_init(void)
>  
>  /***********************************************************************/
>  
> -void hang(void)
> +void __hang(void)
>  {
>  	disable_interrupts();
>  	puts("### ERROR ### Please reset board ###\n");
> @@ -166,3 +166,4 @@ void hang(void)
>  	for (;;)
>  		;
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));
> diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
> index 422b4a3..24bb948 100644
> --- a/arch/powerpc/lib/board.c
> +++ b/arch/powerpc/lib/board.c
> @@ -1050,14 +1050,14 @@ 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");
>  	bootstage_error(BOOTSTAGE_ID_NEED_RESET);
>  	for (;;)
>  		;
>  }
> -
> +void hang(void) __attribute__((weak, alias("__hang")));
>  
>  #if 0	/* We could use plain global data, but the resulting code is bigger */
>  /*
> diff --git a/arch/sandbox/lib/board.c b/arch/sandbox/lib/board.c
> index 3752fab..fe10e6c 100644
> --- a/arch/sandbox/lib/board.c
> +++ b/arch/sandbox/lib/board.c
> @@ -277,9 +277,10 @@ 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")));
> diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c
> index 6e43acf..60be847 100644
> --- a/arch/sh/lib/board.c
> +++ b/arch/sh/lib/board.c
> @@ -203,9 +203,10 @@ void sh_generic_init(void)
>  
>  /***********************************************************************/
>  
> -void hang(void)
> +void __hang(void)
>  {
>  	puts("Board ERROR\n");
>  	for (;;)
>  		;
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));
> diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c
> index 79fb4c8..ddd735c 100644
> --- a/arch/sparc/lib/board.c
> +++ b/arch/sparc/lib/board.c
> @@ -411,7 +411,7 @@ void board_init_f(ulong bootflag)
>  
>  }
>  
> -void hang(void)
> +void __hang(void)
>  {
>  	puts("### ERROR ### Please RESET the board ###\n");
>  #ifdef CONFIG_SHOW_BOOT_PROGRESS
> @@ -419,5 +419,6 @@ void hang(void)
>  #endif
>  	for (;;) ;
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));
>  
>  /************************************************************************/
> diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
> index f372898..960f323 100644
> --- a/arch/x86/lib/board.c
> +++ b/arch/x86/lib/board.c
> @@ -265,9 +265,10 @@ 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")));
> diff --git a/common/board_f.c b/common/board_f.c
> index 7698891..d811067 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -1005,8 +1005,9 @@ void board_init_f_r(void)
>  }
>  #endif /* CONFIG_X86 */
>  
> -void hang(void)
> +void __hang(void)
>  {
>  	puts("### ERROR ### Please RESET the board ###\n");
>  	for (;;);
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 6715e0d..322b7b8 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -48,12 +48,13 @@ struct spl_image_info spl_image;
>  /* Define board data structure */
>  static bd_t bdata __attribute__ ((section(".data")));
>  
> -inline void hang(void)
> +inline void __hang(void)
>  {
>  	puts("### ERROR ### Please RESET the board ###\n");
>  	for (;;)
>  		;
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));
>  
>  /*
>   * Default function to determine if u-boot or the OS should
> diff --git a/drivers/mtd/nand/mxc_nand_spl.c b/drivers/mtd/nand/mxc_nand_spl.c
> index 09f23c3..9738045 100644
> --- a/drivers/mtd/nand/mxc_nand_spl.c
> +++ b/drivers/mtd/nand/mxc_nand_spl.c
> @@ -359,8 +359,9 @@ void nand_boot(void)
>  /*
>   * Called in case of an exception.
>   */
> -void hang(void)
> +void __hang(void)
>  {
>  	/* Loop forever */
>  	while (1) ;
>  }
> +void hang(void) __attribute__((weak, alias("__hang")));

Apart from Stefan's comments: considered standalone, doesn't this patch
have zero effect? I suspect you intend to use this in a later patch,
and if so, I would suggest grouping these in a series so that the
subsequent patch(es) explain this one.

Amicalement,
-- 
Albert.

  parent reply	other threads:[~2013-04-16 11:36 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 10:14 [U-Boot] [PATCH] make hang() a weak function Andreas Bießmann
2013-04-16 10:29 ` Stefan Roese
2013-04-16 11:10 ` Graeme Russ
2013-04-16 11:36 ` Albert ARIBAUD [this message]
2013-04-16 11:45   ` Andreas Bießmann
2013-04-16 12:22     ` Wolfgang Denk
2013-04-16 12:58       ` Andreas Bießmann
2013-04-16 13:05         ` Wolfgang Denk
2013-04-16 13:32           ` Andreas Bießmann
2013-04-16 13:35             ` Graeme Russ
2013-04-16 14:15               ` Andreas Bießmann
2013-04-16 14:20                 ` Graeme Russ
2013-04-16 14:23                 ` Wolfgang Denk
2013-04-16 14:40                   ` Andreas Bießmann
2013-04-16 15:14                     ` Wolfgang Denk
2013-04-16 15:34                       ` Andreas Bießmann
2013-04-16 16:00                         ` Wolfgang Denk
2013-04-16 16:14                           ` Andreas Bießmann
2013-04-16 14:17             ` Wolfgang Denk
2013-04-17 11:02 ` [U-Boot] [PATCH v2 0/5] consolidate hang() Andreas Bießmann
2013-04-17 11:02   ` [U-Boot] [PATCH v2 1/5] microblaze: fix style in board.c Andreas Bießmann
2013-04-17 11:44     ` Michal Simek
2013-04-17 11:54       ` Andreas Bießmann
2013-04-17 11:56         ` Michal Simek
2013-04-17 11:02   ` [U-Boot] [PATCH v2 2/5] nios2: " Andreas Bießmann
2013-04-17 11:02   ` [U-Boot] [PATCH v2 3/5] mx31pdk: add CONFIG_SPL_LIBGENERIC_SUPPORT Andreas Bießmann
2013-04-17 11:02   ` [U-Boot] [PATCH v2 4/5] tx25: " Andreas Bießmann
2013-04-17 11:02   ` [U-Boot] [PATCH v2 5/5] lib: consolidate hang() Andreas Bießmann
2013-04-17 12:58     ` Benoît Thébaudeau
2013-04-18 19:40   ` [U-Boot] [PATCH v2 0/5] " Wolfgang Denk
2013-04-19  8:48   ` [U-Boot] [PATCH v3 " Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 1/5] microblaze: fix style in board.c Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 2/5] nios2: " Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 3/5] mx31pdk: add CONFIG_SPL_LIBGENERIC_SUPPORT Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 4/5] tx25: " Andreas Bießmann
2013-04-19  9:00       ` Benoît Thébaudeau
2013-04-19  9:43         ` Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 5/5] lib: consolidate hang() Andreas Bießmann
2013-04-19  8:57       ` Albert ARIBAUD
2013-05-02 16:05       ` Tom Rini
2013-04-25 21:44     ` [U-Boot] [PATCH v3 0/5] " Simon Glass
2013-05-02 16:06     ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130416133621.40db0a42@lilith \
    --to=albert.u.boot@aribaud.net \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.