Message ID | 1433923603-28119-1-git-send-email-Peng.Fan@freescale.com |
---|---|
State | Changes Requested |
Headers | show |
Hi Peng, On 10/06/2015 10:06, Peng Fan wrote: > is_soc_rev should be casted to signed int, otherwise > may incur errors when detecting cpu types, since we use > such pieces of code: > " > if (is_soc_rev(CHIP_REV_1_0) > 0) ...... > if (is_soc_rev(CHIP_REV_2_0) >= 0) ...... > " > We are mishandling the function. From the name, is_soc_rev() should really return a boolean value. We should call so_rev() instead of is_soc_rev() when we compare versions. > Signed-off-by: Peng Fan <Peng.Fan@freescale.com> > --- > arch/arm/include/asm/arch-mx6/sys_proto.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h > index c583291..9c827c9 100644 > --- a/arch/arm/include/asm/arch-mx6/sys_proto.h > +++ b/arch/arm/include/asm/arch-mx6/sys_proto.h > @@ -12,7 +12,7 @@ > #include "../arch-imx/cpu.h" > > #define soc_rev() (get_cpu_rev() & 0xFF) > -#define is_soc_rev(rev) (soc_rev() - rev) > +#define is_soc_rev(rev) (int)(soc_rev() - rev) > > u32 get_nr_cpus(void); > u32 get_cpu_rev(void); > Best regards, Stefano Babic
Hi Stefano, On Wed, Jun 10, 2015 at 10:20:38AM +0200, Stefano Babic wrote: >Hi Peng, > >On 10/06/2015 10:06, Peng Fan wrote: >> is_soc_rev should be casted to signed int, otherwise >> may incur errors when detecting cpu types, since we use >> such pieces of code: >> " >> if (is_soc_rev(CHIP_REV_1_0) > 0) ...... >> if (is_soc_rev(CHIP_REV_2_0) >= 0) ...... >> " >> > >We are mishandling the function. From the name, is_soc_rev() should >really return a boolean value. We should call so_rev() instead of >is_soc_rev() when we compare versions. ok. Will address patch 2/8 using soc_rev() and discard this patch. Wait for more comments to patch from 2/8 - 8/8, then send out v2. > >> Signed-off-by: Peng Fan <Peng.Fan@freescale.com> >> --- >> arch/arm/include/asm/arch-mx6/sys_proto.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h >> index c583291..9c827c9 100644 >> --- a/arch/arm/include/asm/arch-mx6/sys_proto.h >> +++ b/arch/arm/include/asm/arch-mx6/sys_proto.h >> @@ -12,7 +12,7 @@ >> #include "../arch-imx/cpu.h" >> >> #define soc_rev() (get_cpu_rev() & 0xFF) >> -#define is_soc_rev(rev) (soc_rev() - rev) >> +#define is_soc_rev(rev) (int)(soc_rev() - rev) >> >> u32 get_nr_cpus(void); >> u32 get_cpu_rev(void); >> > >Best regards, >Stefano Babic Regards, Peng. > >-- >===================================================================== >DENX Software Engineering GmbH, Managing Director: Wolfgang Denk >HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany >Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de >=====================================================================
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h index c583291..9c827c9 100644 --- a/arch/arm/include/asm/arch-mx6/sys_proto.h +++ b/arch/arm/include/asm/arch-mx6/sys_proto.h @@ -12,7 +12,7 @@ #include "../arch-imx/cpu.h" #define soc_rev() (get_cpu_rev() & 0xFF) -#define is_soc_rev(rev) (soc_rev() - rev) +#define is_soc_rev(rev) (int)(soc_rev() - rev) u32 get_nr_cpus(void); u32 get_cpu_rev(void);
is_soc_rev should be casted to signed int, otherwise may incur errors when detecting cpu types, since we use such pieces of code: " if (is_soc_rev(CHIP_REV_1_0) > 0) ...... if (is_soc_rev(CHIP_REV_2_0) >= 0) ...... " Signed-off-by: Peng Fan <Peng.Fan@freescale.com> --- arch/arm/include/asm/arch-mx6/sys_proto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)