public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2] i.MX28: Drop __naked function from spl_mem_init
Date: Tue, 20 Mar 2012 08:57:22 +0100	[thread overview]
Message-ID: <4F683862.4030709@denx.de> (raw)
In-Reply-To: <1331933563-5865-1-git-send-email-marex@denx.de>

On 16/03/2012 22:32, Marek Vasut wrote:
> Instead of compiling the function and using the result as a constant, simply use
> the constant.
> 
> NOTE: This patch works around bug:
> 
>   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52546
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Tom Rini <trini@ti.com>
> ---

Hi Marek,

>  arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c |   10 +++-------
>  1 files changed, 3 insertions(+), 7 deletions(-)
> 
> V2: Add comment that this works around bug in GCC
> 
> diff --git a/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c b/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c
> index 43a90ff..911bbef 100644
> --- a/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c
> +++ b/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c
> @@ -173,22 +173,18 @@ void mx28_mem_setup_vddd(void)
>  		&power_regs->hw_power_vdddctrl);
>  }
>  
> -void data_abort_memdetect_handler(void) __attribute__((naked));
> -void data_abort_memdetect_handler(void)
> -{
> -	asm volatile("subs pc, r14, #4");
> -}
> -
>  void mx28_mem_get_size(void)
>  {
>  	struct mx28_digctl_regs *digctl_regs =
>  		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
>  	uint32_t sz, da;
>  	uint32_t *vt = (uint32_t *)0x20;
> +	/* The following is "subs pc, r14, #4", used as return from DABT. */
> +	const uint32_t data_abort_memdetect_handler = 0xe25ef004;

Are we maybe becoming warning addicted ? I know the reason for this (GCC
raises a warning "-fstack-usage not supported for this target"), you
have already asked the gcc people about this issue, and I do not have an
idea how to fix this warning in a different way as you did. This is a
sort of self-modifying code.

However, the original code is quite easy to understand - I cannot say
the same after the patch, we rely on the comment to understand something.

Should we really fix such as warnings even if we generate some obscured
code ? Wolfgang, what do you think about ?

Regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  reply	other threads:[~2012-03-20  7:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Message-Id: <1331903075-10468-1-git-send-email-marex@denx.de>
2012-03-16 21:32 ` [U-Boot] [PATCH V2] i.MX28: Drop __naked function from spl_mem_init Marek Vasut
2012-03-20  7:57   ` Stefano Babic [this message]
2012-03-20  8:21     ` Marek Vasut
2012-03-20  8:39     ` Wolfgang Denk
2012-03-20  9:09       ` Marek Vasut
2012-03-20  9:21         ` Stefano Babic
2012-03-20 17:38         ` Wolfgang Denk
2012-03-20  9:17       ` Stefano Babic
2012-03-20 10:43   ` Stefano Babic

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=4F683862.4030709@denx.de \
    --to=sbabic@denx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox