diff mbox

[U-Boot,V2] MX31: Make get_reset_cause() static

Message ID 1305539647-12222-1-git-send-email-sbabic@denx.de
State Superseded
Headers show

Commit Message

Stefano Babic May 16, 2011, 9:54 a.m. UTC
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(-)

Comments

Jason Liu May 17, 2011, 5:10 a.m. UTC | #1
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@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
Stefano Babic May 17, 2011, 10:02 a.m. UTC | #2
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
diff mbox

Patch

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 =