public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2] MX31: Make get_reset_cause() static
@ 2011-05-16  9:54 Stefano Babic
  2011-05-17  5:10 ` Jason Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Stefano Babic @ 2011-05-16  9:54 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>
---

Changes since V1:
	- as get_cpu_rev is exported, only get_reset_cause
	is set to static.

 arch/arm/cpu/arm1136/mx31/generic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c
index fccd2cd..fb01013 100644
--- a/arch/arm/cpu/arm1136/mx31/generic.c
+++ b/arch/arm/cpu/arm1136/mx31/generic.c
@@ -133,7 +133,7 @@ u32 get_cpu_rev(void)
 	return srev | 0x8000;
 }
 
-char *get_reset_cause(void)
+static char *get_reset_cause(void)
 {
 	/* read RCSR register from CCM module */
 	struct clock_control_regs *ccm =
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH V2] MX31: Make get_reset_cause() static
  2011-05-16  9:54 [U-Boot] [PATCH V2] MX31: Make get_reset_cause() static Stefano Babic
@ 2011-05-17  5:10 ` Jason Liu
  2011-05-17 10:02   ` Stefano Babic
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Liu @ 2011-05-17  5:10 UTC (permalink / raw)
  To: u-boot

Hi, Stefano,

2011/5/16 Stefano Babic <sbabic@denx.de>:
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> ---
>
> Changes since V1:
> ? ? ? ?- as get_cpu_rev is exported, only get_reset_cause
> ? ? ? ?is set to static.
>
> ?arch/arm/cpu/arm1136/mx31/generic.c | ? ?2 +-
> ?1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c
> index fccd2cd..fb01013 100644
> --- a/arch/arm/cpu/arm1136/mx31/generic.c
> +++ b/arch/arm/cpu/arm1136/mx31/generic.c
> @@ -133,7 +133,7 @@ u32 get_cpu_rev(void)
> ? ? ? ?return srev | 0x8000;
> ?}
>
> -char *get_reset_cause(void)
> +static char *get_reset_cause(void)
> ?{
> ? ? ? ?/* read RCSR register from CCM module */
> ? ? ? ?struct clock_control_regs *ccm =
> --

But looking at the code bellow, beside we need make the function static,
do we need to remove the break after the return statement? Otherwise,
some complier may warn un-reachable code, IMHO.

char *get_reset_cause(void)
{
        /* read RCSR register from CCM module */
        struct clock_control_regs *ccm =
                (struct clock_control_regs *)CCM_BASE;

        u32 cause = readl(&ccm->rcsr) & 0x07;

        switch (cause) {
        case 0x0000:
                return "POR";
                break;
        case 0x0001:
                return "RST";
                break;
        case 0x0002:
                return "WDOG";
                break;
        case 0x0006:
                return "JTAG";
                break;
        default:
                return "unknown reset";
        }
}

Jason Liu


> 1.7.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH V2] MX31: Make get_reset_cause() static
  2011-05-17  5:10 ` Jason Liu
@ 2011-05-17 10:02   ` Stefano Babic
  0 siblings, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2011-05-17 10:02 UTC (permalink / raw)
  To: u-boot

On 05/17/2011 07:10 AM, Jason Liu wrote:
> Hi, Stefano,
> 

Hi Jason,

> But looking at the code bellow, beside we need make the function static,
> do we need to remove the break after the return statement? Otherwise,
> some complier may warn un-reachable code, IMHO.

You are right, and the break statement is useless. I have not seen any
warnings when I have merged, probably because I still use an older gcc
version. I will fix it in the same patch and repost.

Best regards,
Stefano Babic

-- 
=====================================================================
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
=====================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-17 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-16  9:54 [U-Boot] [PATCH V2] MX31: Make get_reset_cause() static Stefano Babic
2011-05-17  5:10 ` Jason Liu
2011-05-17 10:02   ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox