imx: fix coding style
Subsystems (2)
PATCH 1/1 imx: fix coding style
Fix checkpatch warning and errors in several i.MX related files.
--- arch/arm/cpu/arm1136/mx31/timer.c | 22 +++-- arch/arm/cpu/arm1136/mx35/generic.c | 2 +- arch/arm/cpu/arm926ejs/mx25/generic.c | 110 +++++++++++++------------- arch/arm/cpu/arm926ejs/mx25/reset.c | 2 +- arch/arm/cpu/arm926ejs/mx25/timer.c | 16 ++-- arch/arm/cpu/arm926ejs/mx27/reset.c | 2 +- arch/arm/cpu/arm926ejs/mx27/timer.c | 14 ++-- arch/arm/cpu/armv7/mx5/soc.c | 10 +-- arch/arm/include/asm/arch-mx5/sys_proto.h | 10 +++ board/davedenx/qong/qong.c | 10 +- board/freescale/mx31ads/mx31ads.c | 2 +- board/karo/tx25/tx25.c | 2 +- board/logicpd/imx27lite/imx27lite.c | 6 +- board/logicpd/imx31_litekit/imx31_litekit.c | 2 +- 14 files changed, 109 insertions(+), 101 deletions(-)
arch/arm/cpu/arm1136/mx31/timer.c +13 -9
@@ -43,7 +43,10 @@DECLARE_GLOBAL_DATA_PTR ; -/* "time" is measured in 1 / CONFIG_SYS_HZ seconds, "tick" is internal timer period */ +/* "time" is measured in 1 / CONFIG_SYS_HZ seconds, +* "tick" is internal timer period +*/ +#ifdef CONFIG_MX31_TIMER_HIGH_PRECISION /* ~0.4% error - measured with stop-watch on 100s boot-delay */ static inline unsigned long long tick_to_time (unsigned long long tick)
@@ -68,7 +71,8 @@ static inline unsigned long long us_to_tick(unsigned long long us) }#else /* ~2% error */ -#define TICK_PER_TIME ((CONFIG_MX31_CLK32 + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) +#define TICK_PER_TIME ((CONFIG_MX31_CLK32 + CONFIG_SYS_HZ / 2) \ + / CONFIG_SYS_HZ)#define US_PER_TICK (1000000 / CONFIG_MX31_CLK32)static inline unsigned long long tick_to_time (unsigned long long tick)
@@ -91,7 +95,7 @@ static inline unsigned long long us_to_tick(unsigned long long us)#endif /* The 32768Hz 32-bit timer overruns in 131072 seconds */ -int timer_init (void ) +int timer_init (void ) {int i;
@@ -106,7 +110,7 @@ int timer_init (void)return 0 ; } -unsigned long long get_ticks (void ) +unsigned long long get_ticks (void ) {ulong now =GPTCNT ;/* current tick value */
@@ -119,7 +123,7 @@ unsigned long long get_ticks (void)return gd->tbl; } -ulong get_timer_masked (void ) +ulong get_timer_masked (void ) {/* * get_ticks() returns a long long (64 bit), it wraps in
@@ -130,13 +134,13 @@ ulong get_timer_masked (void)return tick_to_time (get_ticks ()); } -ulong get_timer (ulong base) +ulong get_timer (ulong base) { -return get_timer_masked () - base; +return get_timer_masked () - base; }/* delay x useconds AND preserve advance timestamp value */ -void __udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
@@ -148,7 +152,7 @@ void __udelay (unsigned long usec)/*NOP*/ ; } -void reset_cpu (ulong addr) +void reset_cpu (ulong addr) {struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE ; wdog->wcr =WDOG_ENABLE ;
arch/arm/cpu/arm1136/mx35/generic.c +1 -1
@@ -240,7 +240,7 @@ unsigned int mxc_get_main_clock(enum mxc_main_clocks clk) }break ;case IPG_CLK : - ret_val =get_ipg_clk ();; + ret_val =get_ipg_clk ();break ;case IPG_PER_CLK : ret_val =get_ipg_per_clk ();
arch/arm/cpu/arm926ejs/mx25/generic.c +55 -55
237 lines not on this page · raw message
arch/arm/cpu/arm926ejs/mx25/reset.c +1 -1
@@ -39,7 +39,7 @@/* * Reset the cpu by setting up the watchdog timer and let it time out */ -void reset_cpu (ulong ignored) +void reset_cpu (ulong ignored) {struct wdog_regs *regs = (struct wdog_regs *)IMX_WDT_BASE ;/* Disable watchdog and set Time-Out field to 0 */
arch/arm/cpu/arm926ejs/mx25/timer.c +8 -8
@@ -15,7 +15,7 @@* * (C) Copyright 2009 DENX Software Engineering * Author: John Rigby <[email protected]> -* Add support for MX25 +* Add support for MX25 * * See file CREDITS for list of people who contributed to this * project.
@@ -43,8 +43,8 @@DECLARE_GLOBAL_DATA_PTR ; -#define timestamp gd->tbl -#define lastinc gd->lastinc +#define timestamp (gd->tbl) +#define lastinc (gd->lastinc)/* * "time" is measured in 1 / CONFIG_SYS_HZ seconds,
@@ -121,7 +121,7 @@ int timer_init(void)return 0 ; } -unsigned long long get_ticks (void ) +unsigned long long get_ticks (void ) {struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE ;ulong now =readl (&gpt->counter);/* current tick value */
@@ -140,7 +140,7 @@ unsigned long long get_ticks (void)return timestamp; } -ulong get_timer_masked (void ) +ulong get_timer_masked (void ) {/* * get_ticks() returns a long long (64 bit), it wraps in
@@ -151,13 +151,13 @@ ulong get_timer_masked (void)return tick_to_time (get_ticks ()); } -ulong get_timer (ulong base) +ulong get_timer (ulong base) { -return get_timer_masked () - base; +return get_timer_masked () - base; }/* delay x useconds AND preserve advance timstamp value */ -void __udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
arch/arm/cpu/arm926ejs/mx27/reset.c +1 -1
@@ -39,7 +39,7 @@/* * Reset the cpu by setting up the watchdog timer and let it time out */ -void reset_cpu (ulong ignored) +void reset_cpu (ulong ignored) {struct wdog_regs *regs = (struct wdog_regs *)IMX_WDT_BASE ;/* Disable watchdog and set Time-Out field to 0 */
arch/arm/cpu/arm926ejs/mx27/timer.c +7 -7
@@ -45,8 +45,8 @@DECLARE_GLOBAL_DATA_PTR ; -#define timestamp gd->tbl -#define lastinc gd->lastinc +#define timestamp (gd->tbl) +#define lastinc (gd->lastinc)/* * "time" is measured in 1 / CONFIG_SYS_HZ seconds,
@@ -124,7 +124,7 @@ int timer_init(void)return 0 ; } -unsigned long long get_ticks (void ) +unsigned long long get_ticks (void ) {struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE ;ulong now =readl (®s->gpt_tcn);/* current tick value */
@@ -143,7 +143,7 @@ unsigned long long get_ticks (void)return timestamp; } -ulong get_timer_masked (void ) +ulong get_timer_masked (void ) {/* * get_ticks() returns a long long (64 bit), it wraps in
@@ -154,13 +154,13 @@ ulong get_timer_masked (void)return tick_to_time (get_ticks ()); } -ulong get_timer (ulong base) +ulong get_timer (ulong base) { -return get_timer_masked () - base; +return get_timer_masked () - base; }/* delay x useconds AND preserve advance timstamp value */ -void __udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
arch/arm/cpu/armv7/mx5/soc.c +2 -8
@@ -26,6 +26,8 @@#include <common.h> #include <asm/arch/imx-regs.h> #include <asm/arch/clock.h> +#include <asm/arch/sys_proto.h> +#include <asm/errno.h> #include <asm/io.h>
@@ -117,14 +119,6 @@ int print_cpuinfo(void) }#endif -/* -* Initializes on-chip ethernet controllers. -* to override, implement board_eth_init() -*/ -#if defined(CONFIG_FEC_MXC ) -extern int fecmxc_initialize (bd_t *bis); -#endif -int cpu_eth_init (bd_t *bis) {int rc = -ENODEV ;
arch/arm/include/asm/arch-mx5/sys_proto.h +10 -0
@@ -28,4 +28,14 @@ u32 get_cpu_rev(void);#define is_soc_rev (rev) ((get_cpu_rev() & 0xFF) - rev)void sdelay (unsigned long );void set_chipselect_size (int const ); + +/* +* Initializes on-chip ethernet controllers. +* to override, implement board_eth_init() +*/ +#if defined(CONFIG_FEC_MXC ) +int fecmxc_initialize (bd_t *bis); + +#endif +#endif
board/davedenx/qong/qong.c +5 -5
@@ -41,7 +41,7 @@ void hw_watchdog_reset(void) }#endif -int dram_init (void ) +int dram_init (void ) {/* dram_init must store complete ramsize in gd->ram_size */ gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
@@ -58,7 +58,7 @@ static void qong_fpga_reset(void)udelay (300 ); } -int board_early_init_f (void ) +int board_early_init_f (void ) {#ifdef CONFIG_QONG_FPGA /* CS1: FPGA/Network Controller/GPIO */
@@ -141,7 +141,7 @@ int board_early_init_f (void) } -int board_init (void ) +int board_init (void ) {/* Chip selects */ /* CS0: Nor Flash #0 - it must be init'ed when executing from DDR */
@@ -216,13 +216,13 @@ int board_late_init(void)return 0 ; } -int checkboard (void ) +int checkboard (void ) {printf ("Board: DAVE/DENX Qong\n" );return 0 ; } -int misc_init_r (void ) +int misc_init_r (void ) {#ifdef CONFIG_QONG_FPGA u32 tmp;
board/freescale/mx31ads/mx31ads.c +1 -1
@@ -104,7 +104,7 @@ int board_init(void)return 0 ; } -int checkboard (void ) +int checkboard (void ) {printf ("Board: MX31ADS\n" );return 0 ;
board/karo/tx25/tx25.c +1 -1
@@ -157,7 +157,7 @@ int board_late_init(void)return 0 ; } -int dram_init (void ) +int dram_init (void ) {/* dram_init must store complete ramsize in gd->ram_size */ gd->ram_size = get_ram_size((void *)PHYS_SDRAM_1,
board/logicpd/imx27lite/imx27lite.c +3 -3
@@ -26,7 +26,7 @@DECLARE_GLOBAL_DATA_PTR ; -int board_init (void ) +int board_init (void ) {struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE ;#if defined(CONFIG_SYS_NAND_LARGEPAGE )
@@ -64,7 +64,7 @@ int board_init (void)return 0 ; } -int dram_init (void ) +int dram_init (void ) {/* dram_init must store complete ramsize in gd->ram_size */ gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
@@ -86,7 +86,7 @@ void dram_init_banksize(void)int checkboard (void ) { -puts ("Board: " ); +puts ("Board: " );puts (CONFIG_BOARDNAME );return 0 ; }
board/logicpd/imx31_litekit/imx31_litekit.c +1 -1
@@ -75,7 +75,7 @@ int board_init(void)return 0 ; } -int checkboard (void ) +int checkboard (void ) {printf ("Board: i.MX31 Litekit\n" );return 0 ;
Signature · 1 line
1.7.1
PATCH 1/1 imx: fix coding style
Quoted 2 lines · Fabio Estevam
Fix checkpatch warning and errors in several i.MX related files.
Hi Fabio,
arch/arm/cpu/arm1136/mx31/timer.c line 48
Quoted 12 lines
arch/arm/cpu/arm1136/mx31/timer.c +3
-1@@ -43,7 +43,10 @@DECLARE_GLOBAL_DATA_PTR ; -/* "time" is measured in 1 / CONFIG_SYS_HZ seconds, "tick" is internal timer period */ +/* "time" is measured in 1 / CONFIG_SYS_HZ seconds, +* "tick" is internal timer period +*/
This style for multiline comments is wrong. Please fix it.
arch/arm/cpu/arm1136/mx31/timer.c
Quoted 8 lines
arch/arm/cpu/arm1136/mx31/timer.c +0
-7-/* -* Initializes on-chip ethernet controllers. -* to override, implement board_eth_init() -*/ -#if defined(CONFIG_FEC_MXC ) -extern int fecmxc_initialize (bd_t *bis); -#endif
Right - the prototype should be in an header file. However, this is not a codestyle issue, it is something more. Can you add in the commit message that you fix this topic too ?
Quoted 8 lines
int
cpu_eth_init(bd_t *bis)
{arch/arm/cpu/arm1136/mx31/timer.c +0
-0int rc = -ENODEV ;arch/arm/include/asm/arch-mx5/sys_proto.h +0
-0
arch/arm/include/asm/arch-mx5/sys_proto.h u32 get_cpu_rev(void); · line 37
Quoted 10 lines
arch/arm/include/asm/arch-mx5/sys_proto.h +7
-0@@ -28,4 +28,14 @@ u32 get_cpu_rev(void);#define is_soc_rev (rev) ((get_cpu_rev() & 0xFF) - rev)void sdelay (unsigned long );void set_chipselect_size (int const ); + +/* +* Initializes on-chip ethernet controllers. +* to override, implement board_eth_init() +*/ +#if defined(CONFIG_FEC_MXC ) +int fecmxc_initialize (bd_t *bis);
Do we really need the #if in the header file ? I think we can get rid of it.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== 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 =====================================================================
Fabio Estevam
reviewerPATCH 1/1 imx: fix coding style
On Wed, Oct 12, 2011 at 7:20 AM, Stefano Babic <[email protected]> wrote:136/mx31/timer.c
Quoted 11 lines
arch/arm/cpu/arm1136/mx31/timer.c line 48
Quoted 9 lines
+++
b/arch/arm/cpu/arm1136/mx31/timer.carch/arm/cpu/arm1136/mx31/timer.c +3
-1@@ -43,7 +43,10 @@ ?DECLARE_GLOBAL_DATA_PTR; -/* "time" is measured in 1 / CONFIG_SYS_HZ seconds, "tick" is internal timer period */ +/* "time" is measured in 1 / CONFIG_SYS_HZ seconds, +* "tick" is internal timer period +*/ This style for multiline comments is wrong. Please fix it.
After applying the patch I read:
/* "time" is measured in 1 / CONFIG_SYS_HZ seconds,
* "tick" is internal timer period
*/
Could you please let me know what is the error?
Quoted 12 lines
arch/arm/cpu/armv7/mx5/soc.c int print_cpuinfo(void) · line 126
Quoted 8 lines
arch/arm/cpu/armv7/mx5/soc.c +0
-7-/* -* Initializes on-chip ethernet controllers. -* to override, implement board_eth_init() -*/ -#if defined(CONFIG_FEC_MXC ) -extern int fecmxc_initialize (bd_t *bis); -#endif Right - the prototype should be in an header file. However, this is not a codestyle issue, it is something more. Can you add in the commit message that you fix this topic too ?
Ok.
Quoted 13 lines
Quoted 13 lines
?int
cpu_eth_init(bd_t *bis)
?{
? ? ? int rc =-ENODEV;arch/arm/include/asm/arch-mx5/sys_proto.h +1
-0@@ -28,4 +28,14 @@ u32 get_cpu_rev(void); ?#define is_soc_rev(rev) ? ? ?((get_cpu_rev() & 0xFF) - rev) ?void sdelay(unsigned long); ?void set_chipselect_size(int const); +
Quoted 8 lines
arch/arm/include/asm/arch-mx5/sys_proto.h u32 get_cpu_rev(void); · line 37
Quoted 6 lines
arch/arm/include/asm/arch-mx5/sys_proto.h +6
-0+/* +* Initializes on-chip ethernet controllers. +* to override, implement board_eth_init() +*/ +#if defined(CONFIG_FEC_MXC ) +int fecmxc_initialize (bd_t *bis);Do we really need the #if in the header file ? I think we can get rid of it.
Ok, I cam remove it.
Regards,
Fabio Estevam
PATCH 1/1 imx: fix coding style
Quoted 9 lines · On Thursday 13 October 2011 17:17:03 Fabio Estevam wrote:
Quoted 1 line
This style for multiline comments is wrong. Please fix it.
After applying the patch I read:
/* "time" is measured in 1 /
CONFIG_SYS_HZseconds,
* "tick" is internal timer period
*/Could you please let me know what is the error?
It should be:
/*
* "time" is measured in 1 / CONFIG_SYS_HZ seconds,
* "tick" is internal timer period
*/
instead.
Cheers,
Stefan
--
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