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

Jason Liu liu.h.jason at gmail.com
Tue May 17 07:10:55 CEST 2011


Hi, Stefano,

2011/5/16 Stefano Babic <sbabic at denx.de>:
> Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
> Signed-off-by: Stefano Babic <sbabic at 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
>


More information about the U-Boot mailing list