Skip to contentSkip to conversation

arm: cleanup board code

PATCH New Heiko Schocher 5 participants 15 messages Jun 3, 2011 – Aug 12, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover arm: cleanup board code

fix Coding Style for arch/arm/lib/board.c
use gd->ram_size instead of bd->bi_memsize

Heiko Schocher (2):
arm, lib/board.c: Coding Style cleanup
arm, lib/board.c: use gd->ram_size instead of bd->bi_memsize

 arch/arm/lib/board.c |  218 ++++++++++++++++++++++++++------------------------
 1 files changed, 113 insertions(+), 105 deletions(-)
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH 1/2 arm, lib/board.c: Coding Style cleanup

---
 arch/arm/lib/board.c |  218 ++++++++++++++++++++++++++------------------------
 1 files changed, 113 insertions(+), 105 deletions(-)
arch/arm/lib/board.c +113 -105
index 1a784a1..05ee71b 100644
@@ -92,26 +92,28 @@ extern void rtl8019_get_enetaddr (uchar * addr);
  ************************************************************************
  * May be supplied by boards if desired
  */
-void inline __coloured_LED_init (void) {}
-void coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
-void inline __red_LED_on (void) {}
-void red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
-void inline __red_LED_off(void) {}
+inline void __coloured_LED_init(void) {}
+void coloured_LED_init(void)
+__attribute__((weak, alias("__coloured_LED_init")));
+inline void __red_LED_on(void) {}
+void red_LED_on(void) __attribute__((weak, alias("__red_LED_on")));
+inline void __red_LED_off(void) {}
 void red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
-void inline __green_LED_on(void) {}
+inline void __green_LED_on(void) {}
 void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
-void inline __green_LED_off(void) {}
+inline void __green_LED_off(void) {}
 void green_LED_off(void) __attribute__((weak, alias("__green_LED_off")));
-void inline __yellow_LED_on(void) {}
+inline void __yellow_LED_on(void) {}
 void yellow_LED_on(void) __attribute__((weak, alias("__yellow_LED_on")));
-void inline __yellow_LED_off(void) {}
+inline void __yellow_LED_off(void) {}
 void yellow_LED_off(void) __attribute__((weak, alias("__yellow_LED_off")));
-void inline __blue_LED_on(void) {}
+inline void __blue_LED_on(void) {}
 void blue_LED_on(void) __attribute__((weak, alias("__blue_LED_on")));
-void inline __blue_LED_off(void) {}
+inline void __blue_LED_off(void) {}
 void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 
-/************************************************************************
+/*
+ ************************************************************************
  * Init Utilities							*
  ************************************************************************
  * Some of this code should be moved into the core functions,
@@ -122,30 +124,30 @@ void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 #if defined(CONFIG_ARM_DCC) && !defined(CONFIG_BAUDRATE)
 #define CONFIG_BAUDRATE 115200
 #endif
-static int init_baudrate (void)
+static int init_baudrate(void)
 {
 	char tmp[64];	/* long enough for environment variables */
-	int i = getenv_f("baudrate", tmp, sizeof (tmp));
+	int i = getenv_f("baudrate", tmp, sizeof(tmp));
 
 	gd->baudrate = (i > 0)
-			? (int) simple_strtoul (tmp, NULL, 10)
+			? (int) simple_strtoul(tmp, NULL, 10)
 			: CONFIG_BAUDRATE;
 
 	return (0);
 }
 
-static int display_banner (void)
+static int display_banner(void)
 {
-	printf ("\n\n%s\n\n", version_string);
-	debug ("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
+	printf("\n\n%s\n\n", version_string);
+	debug("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
 	       _TEXT_BASE,
-	       _bss_start_ofs+_TEXT_BASE, _bss_end_ofs+_TEXT_BASE);
+	       _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE);
 #ifdef CONFIG_MODEM_SUPPORT
-	debug ("Modem Support enabled\n");
+	debug("Modem Support enabled\n");
 #endif
 #ifdef CONFIG_USE_IRQ
-	debug ("IRQ Stack: %08lx\n", IRQ_STACK_START);
-	debug ("FIQ Stack: %08lx\n", FIQ_STACK_START);
+	debug("IRQ Stack: %08lx\n", IRQ_STACK_START);
+	debug("FIQ Stack: %08lx\n", FIQ_STACK_START);
 #endif
 
 	return (0);
@@ -158,23 +160,23 @@ static int display_banner (void)
  * gives a simple yet clear indication which part of the
  * initialization if failing.
  */
-static int display_dram_config (void)
+static int display_dram_config(void)
 {
 	int i;
 
 #ifdef DEBUG
-	puts ("RAM Configuration:\n");
+	puts("RAM Configuration:\n");
 
-	for(i=0; i<CONFIG_NR_DRAM_BANKS; i++) {
-		printf ("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
-		print_size (gd->bd->bi_dram[i].size, "\n");
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		printf("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
+		print_size(gd->bd->bi_dram[i].size, "\n");
 	}
 #else
 	ulong size = 0;
 
-	for (i=0; i<CONFIG_NR_DRAM_BANKS; i++) {
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
 		size += gd->bd->bi_dram[i].size;
-	}
+
 	puts("DRAM:  ");
 	print_size(size, "\n");
 #endif
@@ -183,11 +185,11 @@ static int display_dram_config (void)
 }
 
 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
-static int init_func_i2c (void)
+static int init_func_i2c(void)
 {
-	puts ("I2C:   ");
-	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-	puts ("ready\n");
+	puts("I2C:   ");
+	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	puts("ready\n");
 	return (0);
 }
 #endif
@@ -226,7 +228,7 @@ static int arm_pci_init(void)
  */
 typedef int (init_fnc_t) (void);
 
-int print_cpuinfo (void);
+int print_cpuinfo(void);
 
 void __dram_init_banksize(void)
 {
@@ -268,7 +270,7 @@ init_fnc_t *init_sequence[] = {
 	NULL,
 };
 
-void board_init_f (ulong bootflag)
+void board_init_f(ulong bootflag)
 {
 	bd_t *bd;
 	init_fnc_t **init_fnc_ptr;
@@ -280,7 +282,7 @@ void board_init_f (ulong bootflag)
 	/* compiler optimization barrier needed for GCC >= 3.4 */
 	__asm__ __volatile__("": : :"memory");
 
-	memset ((void*)gd, 0, sizeof (gd_t));
+	memset((void *)gd, 0, sizeof(gd_t));
 
 	gd->mon_len = _bss_end_ofs;
 
@@ -290,11 +292,11 @@ void board_init_f (ulong bootflag)
 		}
 	}
 
-	debug ("monitor len: %08lX\n", gd->mon_len);
+	debug("monitor len: %08lX\n", gd->mon_len);
 	/*
 	 * Ram is setup, size stored in gd !!
 	 */
-	debug ("ramsize: %08lX\n", gd->ram_size);
+	debug("ramsize: %08lX\n", gd->ram_size);
 #if defined(CONFIG_SYS_MEM_TOP_HIDE)
 	/*
 	 * Subtract specified amount of memory to hide so that it won't
@@ -315,7 +317,8 @@ void board_init_f (ulong bootflag)
 #ifndef CONFIG_ALT_LB_ADDR
 	/* reserve kernel log buffer */
 	addr -= (LOGBUFF_RESERVE);
-	debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr);
+	debug("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN,
+		addr);
 #endif
 #endif
 
@@ -323,10 +326,11 @@ void board_init_f (ulong bootflag)
 	/*
 	 * reserve protected RAM
 	 */
-	i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
-	reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
+	i = getenv_r("pram", (char *)tmp, sizeof(tmp));
+	reg = (i > 0) ? simple_strtoul((const char *)tmp, NULL, 10) :
+		CONFIG_PRAM;
 	addr -= (reg << 10);		/* size is in kB */
-	debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
+	debug("Reserving %ldk for protected RAM@%08lx\n", reg, addr);
 #endif /* CONFIG_PRAM */
 
 #if !(defined(CONFIG_SYS_NO_ICACHE) && defined(CONFIG_SYS_NO_DCACHE))
@@ -337,12 +341,12 @@ void board_init_f (ulong bootflag)
 	addr &= ~(0x10000 - 1);
 
 	gd->tlb_addr = addr;
-	debug ("TLB table at: %08lx\n", addr);
+	debug("TLB table at: %08lx\n", addr);
 #endif
 
 	/* round down to next 4 kB limit */
 	addr &= ~(4096 - 1);
-	debug ("Top of RAM usable for U-Boot at: %08lx\n", addr);
+	debug("Top of RAM usable for U-Boot at: %08lx\n", addr);
 
 #ifdef CONFIG_VFD
 #	ifndef PAGE_SIZE
@@ -351,7 +355,7 @@ void board_init_f (ulong bootflag)
 	/*
 	 * reserve memory for VFD display (always full pages)
 	 */
-	addr -= vfd_setmem (addr);
+	addr -= vfd_setmem(addr);
 	gd->fb_base = addr;
 #endif /* CONFIG_VFD */
 
@@ -360,7 +364,7 @@ void board_init_f (ulong bootflag)
 	gd->fb_base = CONFIG_FB_ADDR;
 #else
 	/* reserve memory for LCD display (always full pages) */
-	addr = lcd_setmem (addr);
+	addr = lcd_setmem(addr);
 	gd->fb_base = addr;
 #endif /* CONFIG_FB_ADDR */
 #endif /* CONFIG_LCD */
@@ -372,14 +376,14 @@ void board_init_f (ulong bootflag)
 	addr -= gd->mon_len;
 	addr &= ~(4096 - 1);
 
-	debug ("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, addr);
+	debug("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, addr);
 
 #ifndef CONFIG_PRELOADER
 	/*
 	 * reserve memory for malloc() arena
 	 */
 	addr_sp = addr - TOTAL_MALLOC_LEN;
-	debug ("Reserving %dk for malloc() at: %08lx\n",
+	debug("Reserving %dk for malloc() at: %08lx\n",
 			TOTAL_MALLOC_LEN >> 10, addr_sp);
 	/*
 	 * (permanently) allocate a Board Info struct
@@ -388,18 +392,18 @@ void board_init_f (ulong bootflag)
 	addr_sp -= sizeof (bd_t);
 	bd = (bd_t *) addr_sp;
 	gd->bd = bd;
-	debug ("Reserving %zu Bytes for Board Info at: %08lx\n",
+	debug("Reserving %zu Bytes for Board Info at: %08lx\n",
 			sizeof (bd_t), addr_sp);
 	addr_sp -= sizeof (gd_t);
 	id = (gd_t *) addr_sp;
-	debug ("Reserving %zu Bytes for Global Data at: %08lx\n",
+	debug("Reserving %zu Bytes for Global Data at: %08lx\n",
 			sizeof (gd_t), addr_sp);
 
 	/* setup stackpointer for exeptions */
 	gd->irq_sp = addr_sp;
 #ifdef CONFIG_USE_IRQ
 	addr_sp -= (CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ);
-	debug ("Reserving %zu Bytes for IRQ stack at: %08lx\n",
+	debug("Reserving %zu Bytes for IRQ stack at: %08lx\n",
 		CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ, addr_sp);
 #endif
 	/* leave 3 words for abort-stack    */
@@ -412,11 +416,11 @@ void board_init_f (ulong bootflag)
 	gd->irq_sp = addr_sp;
 #endif
 
-	debug ("New Stack Pointer is: %08lx\n", addr_sp);
+	debug("New Stack Pointer is: %08lx\n", addr_sp);
 
 #ifdef CONFIG_POST
 	post_bootmode_init();
-	post_run (NULL, POST_ROM | post_bootmode_get(0));
+	post_run(NULL, POST_ROM | post_bootmode_get(0));
 #endif
 
 	gd->bd->bi_baudrate = gd->baudrate;
@@ -427,10 +431,10 @@ void board_init_f (ulong bootflag)
 	gd->relocaddr = addr;
 	gd->start_addr_sp = addr_sp;
 	gd->reloc_off = addr - _TEXT_BASE;
-	debug ("relocation Offset is: %08lx\n", gd->reloc_off);
-	memcpy (id, (void *)gd, sizeof (gd_t));
+	debug("relocation Offset is: %08lx\n", gd->reloc_off);
+	memcpy(id, (void *)gd, sizeof(gd_t));
 
-	relocate_code (addr_sp, id, addr);
+	relocate_code(addr_sp, id, addr);
 
 	/* NOTREACHED - relocate_code() does not return */
 }
@@ -439,7 +443,8 @@ void board_init_f (ulong bootflag)
 static char *failed = "*** failed ***\n";
 #endif
 
-/************************************************************************
+/*
+ ************************************************************************
  *
  * This is the next part if the initialization sequence: we are now
  * running from RAM and have a "normal" C environment, i. e. global
@@ -449,7 +454,7 @@ static char *failed = "*** failed ***\n";
  ************************************************************************
  */
 
-void board_init_r (gd_t *id, ulong dest_addr)
+void board_init_r(gd_t *id, ulong dest_addr)
 {
 	char *s;
 	bd_t *bd;
@@ -464,20 +469,20 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
 	monitor_flash_len = _end_ofs;
-	debug ("monitor flash len: %08lX\n", monitor_flash_len);
+	debug("monitor flash len: %08lX\n", monitor_flash_len);
 	board_init();	/* Setup chipselects */
 
 #ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
 #endif
 
-	debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
+	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
 #ifdef CONFIG_LOGBUFFER
-	logbuff_init_ptrs ();
+	logbuff_init_ptrs();
 #endif
 #ifdef CONFIG_POST
-	post_output_backlog ();
+	post_output_backlog();
 #endif
 
 	/* The Malloc area is immediately below the monitor copy in DRAM */
@@ -485,34 +490,37 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
 
 #if !defined(CONFIG_SYS_NO_FLASH)
-	puts ("Flash: ");
+	puts("Flash: ");
 
-	if ((flash_size = flash_init ()) > 0) {
+	flash_size = flash_init();
+	if (flash_size > 0) {
 # ifdef CONFIG_SYS_FLASH_CHECKSUM
-		print_size (flash_size, "");
+		print_size(flash_size, "");
 		/*
 		 * Compute and print flash CRC if flashchecksum is set to 'y'
 		 *
 		 * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
 		 */
-		s = getenv ("flashchecksum");
+		s = getenv("flashchecksum");
 		if (s && (*s == 'y')) {
-			printf ("  CRC: %08X",
-				crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size)
+			printf("  CRC: %08X",
+				crc32(0,
+				(const unsigned char *) CONFIG_SYS_FLASH_BASE,
+				flash_size)
 			);
 		}
-		putc ('\n');
+		putc('\n');
 # else	/* !CONFIG_SYS_FLASH_CHECKSUM */
-		print_size (flash_size, "\n");
+		print_size(flash_size, "\n");
 # endif /* CONFIG_SYS_FLASH_CHECKSUM */
 	} else {
-		puts (failed);
-		hang ();
+		puts(failed);
+		hang();
 	}
 #endif
 
 #if defined(CONFIG_CMD_NAND)
-	puts ("NAND:  ");
+	puts("NAND:  ");
 	nand_init();		/* go init the NAND */
 #endif
 
@@ -531,7 +539,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 
 	/* initialize environment */
-	env_relocate ();
+	env_relocate();
 
 #ifdef CONFIG_VFD
 	/* must do this after the framebuffer is allocated */
@@ -539,37 +547,37 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif /* CONFIG_VFD */
 
 	/* IP Address */
-	gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
+	gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
 
-	stdio_init ();	/* get the devices list going. */
+	stdio_init();	/* get the devices list going. */
 
-	jumptable_init ();
+	jumptable_init();
 
 #if defined(CONFIG_API)
 	/* Initialize API */
-	api_init ();
+	api_init();
 #endif
 
-	console_init_r ();	/* fully init console as a device */
+	console_init_r();	/* fully init console as a device */
 
 #if defined(CONFIG_ARCH_MISC_INIT)
 	/* miscellaneous arch dependent initialisations */
-	arch_misc_init ();
+	arch_misc_init();
 #endif
 #if defined(CONFIG_MISC_INIT_R)
 	/* miscellaneous platform dependent initialisations */
-	misc_init_r ();
+	misc_init_r();
 #endif
 
 	 /* set up exceptions */
-	interrupt_init ();
+	interrupt_init();
 	/* enable exceptions */
-	enable_interrupts ();
+	enable_interrupts();
 
 	/* Perform network card initialisation if necessary */
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
-	if (getenv ("ethaddr")) {
+	if (getenv("ethaddr")) {
 		uchar enetaddr[6];
 		eth_getenv_enetaddr("ethaddr", enetaddr);
 		smc_set_mac_addr(enetaddr);
@@ -577,17 +585,17 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */
 
 	/* Initialize from environment */
-	if ((s = getenv ("loadaddr")) != NULL) {
-		load_addr = simple_strtoul (s, NULL, 16);
-	}
+	s = getenv("loadaddr");
+	if (s != NULL)
+		load_addr = simple_strtoul(s, NULL, 16);
 #if defined(CONFIG_CMD_NET)
-	if ((s = getenv ("bootfile")) != NULL) {
-		copy_filename (BootFile, s, sizeof (BootFile));
-	}
+	s = getenv("bootfile");
+	if (s != NULL)
+		copy_filename(BootFile, s, sizeof(BootFile));
 #endif
 
 #ifdef BOARD_LATE_INIT
-	board_late_init ();
+	board_late_init();
 #endif
 
 #ifdef CONFIG_BITBANGMII
@@ -595,17 +603,17 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
-	puts ("Net:   ");
+	puts("Net:   ");
 #endif
 	eth_initialize(gd->bd);
 #if defined(CONFIG_RESET_PHY_R)
-	debug ("Reset Ethernet PHY\n");
+	debug("Reset Ethernet PHY\n");
 	reset_phy();
 #endif
 #endif
 
 #ifdef CONFIG_POST
-	post_run (NULL, POST_RAM | post_bootmode_get(0));
+	post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif
 
 #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
@@ -619,35 +627,35 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #ifdef CONFIG_PRAM
 		char *s;
 
-		if ((s = getenv ("pram")) != NULL) {
-			pram = simple_strtoul (s, NULL, 10);
-		} else {
+		s = getenv("pram");
+		if (s != NULL)
+			pram = simple_strtoul(s, NULL, 10);
+		else
 			pram = CONFIG_PRAM;
-		}
 #else
-		pram=0;
+		pram = 0;
 #endif
 #ifdef CONFIG_LOGBUFFER
 #ifndef CONFIG_ALT_LB_ADDR
 		/* Also take the logbuffer into account (pram is in kB) */
-		pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
+		pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 #endif
 #endif
-		sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
-		setenv ("mem", (char *)memsz);
+		sprintf((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
+		setenv("mem", (char *)memsz);
 	}
 #endif
 
 	/* main_loop() can return to retry autoboot, if so just run it again. */
 	for (;;) {
-		main_loop ();
+		main_loop();
 	}
 
 	/* NOTREACHED - no way out of command loop except booting */
 }
 
-void hang (void)
+void hang(void)
 {
-	puts ("### ERROR ### Please RESET the board ###\n");
+	puts("### ERROR ### Please RESET the board ###\n");
 	for (;;);
 }
Signature · 1 line
1.7.4.4
#2 lore raw

PATCH 1/2 arm, lib/board.c: Coding Style cleanup

Hallo Heiko,

Quoted 5 lines
---
 arch/arm/lib/board.c |  218 ++++++++++++++++++++++++++------------------------
 1 files changed, 113 insertions(+), 105 deletions(-)

If this is meant to be a patch without any "real" changes, it should be marked with "cosmetic: " so that people know it does not introduce functional changes.

The script that I posted a while ago here, indeed makes it easy to check only the non-whitespace parts and they look good, so

Cheers
Detlev

Signature · 8 lines
Each language has its purpose, however humble. Each language expresses
the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it.
                           -- The Tao of Programming
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#3 lore raw

PATCH 1/2 arm, lib/board.c: Coding Style cleanup

In reply to Heiko Schocher

Hi Heiko,

Sorry for having kept this patch unanswered so long. I am now on holiday, which means *a bit* more time for U-Boot, so here comes:

Re: patch title, can you make it "arm: libboard.c: ..." rather than "arm, libboard.c" ?

Also, make sure you rebase onto latest u-boot-arm/master for next
version: this one does not apply cleanly ATM.

Le 03/06/2011 10:11, Heiko Schocher a ?crit :

Quoted 4 lines
arch/arm/lib/board.c +0 -0
@@ -92,26 +92,28 @@ extern void rtl8019_get_enetaddr (uchar * addr);
   ************************************************************************

arch/arm/lib/board.c extern void rtl8019_get_enetaddr (uchar * addr); · line 97

Quoted 10 lines
arch/arm/lib/board.c +3 -5
   * May be supplied by boards if desired
   */
-void inline __coloured_LED_init (void) {}
-void coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
-void inline __red_LED_on (void) {}
-void red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
-void inline __red_LED_off(void) {}
+inline void __coloured_LED_init(void) {}
+void coloured_LED_init(void)
+__attribute__((weak, alias("__coloured_LED_init")));

If you break the declaration in several lines, please leave some indentation in the second and subsequent lines.

Quoted 46 lines
arch/arm/lib/board.c +15 -10
+inline void __red_LED_on(void) {}
+void red_LED_on(void) __attribute__((weak, alias("__red_LED_on")));
+inline void __red_LED_off(void) {}
  void red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
-void inline __green_LED_on(void) {}
+inline void __green_LED_on(void) {}
  void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
-void inline __green_LED_off(void) {}
+inline void __green_LED_off(void) {}
  void green_LED_off(void) __attribute__((weak, alias("__green_LED_off")));
-void inline __yellow_LED_on(void) {}
+inline void __yellow_LED_on(void) {}
  void yellow_LED_on(void) __attribute__((weak, alias("__yellow_LED_on")));
-void inline __yellow_LED_off(void) {}
+inline void __yellow_LED_off(void) {}
  void yellow_LED_off(void) __attribute__((weak, alias("__yellow_LED_off")));
-void inline __blue_LED_on(void) {}
+inline void __blue_LED_on(void) {}
  void blue_LED_on(void) __attribute__((weak, alias("__blue_LED_on")));
-void inline __blue_LED_off(void) {}
+inline void __blue_LED_off(void) {}
  void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 
-/************************************************************************
+/*
+ ************************************************************************
   * Init Utilities							*
   ************************************************************************
   * Some of this code should be moved into the core functions,
@@ -485,34 +490,37 @@ void board_init_r (gd_t *id, ulong dest_addr)
  	mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
 
  #if !defined(CONFIG_SYS_NO_FLASH)
-	puts ("Flash: ");
+	puts("Flash: ");
 
-	if ((flash_size = flash_init ())>  0) {
+	flash_size = flash_init();
+	if (flash_size>  0) {
  # ifdef CONFIG_SYS_FLASH_CHECKSUM
-		print_size (flash_size, "");
+		print_size(flash_size, "");
  		/*
  		 * Compute and print flash CRC if flashchecksum is set to 'y'
  		 *
  		 * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX

arch/arm/lib/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 509

Quoted 10 lines
arch/arm/lib/board.c +5 -3
  		 */
-		s = getenv ("flashchecksum");
+		s = getenv("flashchecksum");
  		if (s&&  (*s == 'y')) {
-			printf ("  CRC: %08X",
-				crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size)
+			printf("  CRC: %08X",
+				crc32(0,
+				(const unsigned char *) CONFIG_SYS_FLASH_BASE,
+				flash_size)

Pleas indent deeper for the last two lines that belong to the call to crc32.

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH 1/2 arm, lib/board.c: Coding Style cleanup

Hi Heiko and Albert,

2011/7/15 Albert ARIBAUD <[email protected]>

Quoted 8 lines

Hi Heiko,

Sorry for having kept this patch unanswered so long. I am now on holiday, which means *a bit* more time for U-Boot, so here comes:

Re: patch title, can you make it "arm: libboard.c: ..." rather than "arm, libboard.c" ?

Just remind both of you here, about the clean up patches, we have an other prefix for the patch title (subject).

http://www.denx.de/wiki/U-Boot/Patches
General Patch Submission Rules

"Non-functional changes, i.e. whitespace and reformatting changes, should be done in separate patches marked as cosmetic. This separation of functional and cosmetic changes greatly facilitates the review process."

So, please use "cosmetic:" as the beginning prefix of your clear up patch.

Quoted 3 lines

Also, make sure you rebase onto latest u-boot-arm/master for next
version: this one does not apply cleanly ATM.

[deleted]

Quoted 11 lines
Quoted 7 lines

- ? ? ? ? ? ? ? ? ? ? printf (" ?CRC: %08X",
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size)
+ ? ? ? ? ? ? ? ? ? ? printf(" ?CRC: %08X",
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? crc32(0,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? (const unsigned char *) CONFIG_SYS_FLASH_BASE,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? flash_size)

Pleas indent deeper for the last two lines that belong to the call to crc32.

Amicalement,

--
Best regards,
Macpaul Lin

#5 lore raw

PATCH 1/2 arm, lib/board.c: Coding Style cleanup

In reply to Albert ARIBAUD

Hello Albert,

Quoted 7 lines · Albert ARIBAUD

Hi Heiko,

Sorry for having kept this patch unanswered so long. I am now on holiday, which means *a bit* more time for U-Boot, so here comes:

Re: patch title, can you make it "arm: libboard.c: ..." rather than "arm, libboard.c" ?

Yep, do this. Also add "cosmetic" as "macpaul at gmail.com" commented.

Quoted 2 lines

Also, make sure you rebase onto latest u-boot-arm/master for next
version: this one does not apply cleanly ATM.

Yes, I saw this too now, but at the time I posted the patch, it applied clean...

Quoted 6 lines

Le 03/06/2011 10:11, Heiko Schocher a ?crit :

Quoted 4 lines
arch/arm/lib/board.c +0 -0
@@ -92,26 +92,28 @@ extern void rtl8019_get_enetaddr (uchar * addr);
 
Quoted 15 lines

arch/arm/lib/board.c extern void rtl8019_get_enetaddr (uchar * addr); · line 97

Quoted 12 lines
arch/arm/lib/board.c +3 -5
 ************************************************************************
   * May be supplied by boards if desired
   */
-void inline __coloured_LED_init (void) {}
-void coloured_LED_init (void) __attribute__((weak,
 alias("__coloured_LED_init")));
-void inline __red_LED_on (void) {}
-void red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
-void inline __red_LED_off(void) {}
+inline void __coloured_LED_init(void) {}
+void coloured_LED_init(void)
+__attribute__((weak, alias("__coloured_LED_init")));

If you break the declaration in several lines, please leave some indentation in the second and subsequent lines.

Ok, fixed.

Quoted 58 lines
Quoted 58 lines
arch/arm/lib/board.c +11 -7
+inline void __red_LED_on(void) {}
+void red_LED_on(void) __attribute__((weak, alias("__red_LED_on")));
+inline void __red_LED_off(void) {}
  void red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
-void inline __green_LED_on(void) {}
+inline void __green_LED_on(void) {}
  void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
-void inline __green_LED_off(void) {}
+inline void __green_LED_off(void) {}
  void green_LED_off(void) __attribute__((weak,
 alias("__green_LED_off")));
-void inline __yellow_LED_on(void) {}
+inline void __yellow_LED_on(void) {}
  void yellow_LED_on(void) __attribute__((weak,
 alias("__yellow_LED_on")));
-void inline __yellow_LED_off(void) {}
+inline void __yellow_LED_off(void) {}
  void yellow_LED_off(void) __attribute__((weak,
 alias("__yellow_LED_off")));
-void inline __blue_LED_on(void) {}
+inline void __blue_LED_on(void) {}
  void blue_LED_on(void) __attribute__((weak, alias("__blue_LED_on")));
-void inline __blue_LED_off(void) {}
+inline void __blue_LED_off(void) {}
  void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 
-/************************************************************************
 
+/*
+

************************************************************************
* Init Utilities *

************************************************************************
* Some of this code should be moved into the core functions,

arch/arm/lib/board.c +5 -6
@@ -485,34 +490,37 @@ void board_init_r (gd_t *id, ulong dest_addr)
      mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
 
  #if !defined(CONFIG_SYS_NO_FLASH)
-    puts ("Flash: ");
+    puts("Flash: ");
 
-    if ((flash_size = flash_init ())>  0) {
+    flash_size = flash_init();
+    if (flash_size>  0) {
  # ifdef CONFIG_SYS_FLASH_CHECKSUM
-        print_size (flash_size, "");
+        print_size(flash_size, "");
          /*
           * Compute and print flash CRC if flashchecksum is set to 'y'
           *
           * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
           */
-        s = getenv ("flashchecksum");
+        s = getenv("flashchecksum");
          if (s&&  (*s == 'y')) {
-            printf ("  CRC: %08X",
-                crc32 (0, (const unsigned char *)
Quoted 8 lines

arch/arm/lib/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 509

Quoted 5 lines
arch/arm/lib/board.c +4 -0
 CONFIG_SYS_FLASH_BASE, flash_size)
+            printf("  CRC: %08X",
+                crc32(0,
+                (const unsigned char *) CONFIG_SYS_FLASH_BASE,
+                flash_size)

Pleas indent deeper for the last two lines that belong to the call to crc32.

Ups, I think, the crc32 call could be in the previous line! Fixed.

Thanks for the review!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#6 lore raw

PATCH v2 1/2 cosmetic: arm: libboard.c: Coding Style cleanup

In reply to Heiko Schocher

---
changes for v2:
Added Acked-by from Detlev Zundel
Added comments from Albert Aribaud:
- fixed some Codingstyle issues
- changed subject title
Added comment from macpaul at gmail.com:
- Add cosmetic to subject title

 arch/arm/lib/board.c |  216 ++++++++++++++++++++++++++------------------------
 1 files changed, 111 insertions(+), 105 deletions(-)
arch/arm/lib/board.c +111 -105
index fc52a26..8b11eb1 100644
@@ -92,26 +92,28 @@ extern void rtl8019_get_enetaddr (uchar * addr);
  ************************************************************************
  * May be supplied by boards if desired
  */
-void inline __coloured_LED_init (void) {}
-void coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
-void inline __red_LED_on (void) {}
-void red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
-void inline __red_LED_off(void) {}
+inline void __coloured_LED_init(void) {}
+void coloured_LED_init(void)
+	__attribute__((weak, alias("__coloured_LED_init")));
+inline void __red_LED_on(void) {}
+void red_LED_on(void) __attribute__((weak, alias("__red_LED_on")));
+inline void __red_LED_off(void) {}
 void red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
-void inline __green_LED_on(void) {}
+inline void __green_LED_on(void) {}
 void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
-void inline __green_LED_off(void) {}
+inline void __green_LED_off(void) {}
 void green_LED_off(void) __attribute__((weak, alias("__green_LED_off")));
-void inline __yellow_LED_on(void) {}
+inline void __yellow_LED_on(void) {}
 void yellow_LED_on(void) __attribute__((weak, alias("__yellow_LED_on")));
-void inline __yellow_LED_off(void) {}
+inline void __yellow_LED_off(void) {}
 void yellow_LED_off(void) __attribute__((weak, alias("__yellow_LED_off")));
-void inline __blue_LED_on(void) {}
+inline void __blue_LED_on(void) {}
 void blue_LED_on(void) __attribute__((weak, alias("__blue_LED_on")));
-void inline __blue_LED_off(void) {}
+inline void __blue_LED_off(void) {}
 void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 
-/************************************************************************
+/*
+ ************************************************************************
  * Init Utilities							*
  ************************************************************************
  * Some of this code should be moved into the core functions,
@@ -122,30 +124,30 @@ void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 #if defined(CONFIG_ARM_DCC) && !defined(CONFIG_BAUDRATE)
 #define CONFIG_BAUDRATE 115200
 #endif
-static int init_baudrate (void)
+static int init_baudrate(void)
 {
 	char tmp[64];	/* long enough for environment variables */
-	int i = getenv_f("baudrate", tmp, sizeof (tmp));
+	int i = getenv_f("baudrate", tmp, sizeof(tmp));
 
 	gd->baudrate = (i > 0)
-			? (int) simple_strtoul (tmp, NULL, 10)
+			? (int) simple_strtoul(tmp, NULL, 10)
 			: CONFIG_BAUDRATE;
 
 	return (0);
 }
 
-static int display_banner (void)
+static int display_banner(void)
 {
-	printf ("\n\n%s\n\n", version_string);
-	debug ("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
+	printf("\n\n%s\n\n", version_string);
+	debug("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
 	       _TEXT_BASE,
-	       _bss_start_ofs+_TEXT_BASE, _bss_end_ofs+_TEXT_BASE);
+	       _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE);
 #ifdef CONFIG_MODEM_SUPPORT
-	debug ("Modem Support enabled\n");
+	debug("Modem Support enabled\n");
 #endif
 #ifdef CONFIG_USE_IRQ
-	debug ("IRQ Stack: %08lx\n", IRQ_STACK_START);
-	debug ("FIQ Stack: %08lx\n", FIQ_STACK_START);
+	debug("IRQ Stack: %08lx\n", IRQ_STACK_START);
+	debug("FIQ Stack: %08lx\n", FIQ_STACK_START);
 #endif
 
 	return (0);
@@ -158,23 +160,23 @@ static int display_banner (void)
  * gives a simple yet clear indication which part of the
  * initialization if failing.
  */
-static int display_dram_config (void)
+static int display_dram_config(void)
 {
 	int i;
 
 #ifdef DEBUG
-	puts ("RAM Configuration:\n");
+	puts("RAM Configuration:\n");
 
-	for(i=0; i<CONFIG_NR_DRAM_BANKS; i++) {
-		printf ("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
-		print_size (gd->bd->bi_dram[i].size, "\n");
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		printf("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
+		print_size(gd->bd->bi_dram[i].size, "\n");
 	}
 #else
 	ulong size = 0;
 
-	for (i=0; i<CONFIG_NR_DRAM_BANKS; i++) {
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
 		size += gd->bd->bi_dram[i].size;
-	}
+
 	puts("DRAM:  ");
 	print_size(size, "\n");
 #endif
@@ -183,11 +185,11 @@ static int display_dram_config (void)
 }
 
 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
-static int init_func_i2c (void)
+static int init_func_i2c(void)
 {
-	puts ("I2C:   ");
-	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-	puts ("ready\n");
+	puts("I2C:   ");
+	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	puts("ready\n");
 	return (0);
 }
 #endif
@@ -226,7 +228,7 @@ static int arm_pci_init(void)
  */
 typedef int (init_fnc_t) (void);
 
-int print_cpuinfo (void);
+int print_cpuinfo(void);
 
 void __dram_init_banksize(void)
 {
@@ -265,7 +267,7 @@ init_fnc_t *init_sequence[] = {
 	NULL,
 };
 
-void board_init_f (ulong bootflag)
+void board_init_f(ulong bootflag)
 {
 	bd_t *bd;
 	init_fnc_t **init_fnc_ptr;
@@ -277,7 +279,7 @@ void board_init_f (ulong bootflag)
 	/* compiler optimization barrier needed for GCC >= 3.4 */
 	__asm__ __volatile__("": : :"memory");
 
-	memset ((void*)gd, 0, sizeof (gd_t));
+	memset((void *)gd, 0, sizeof(gd_t));
 
 	gd->mon_len = _bss_end_ofs;
 
@@ -287,11 +289,11 @@ void board_init_f (ulong bootflag)
 		}
 	}
 
-	debug ("monitor len: %08lX\n", gd->mon_len);
+	debug("monitor len: %08lX\n", gd->mon_len);
 	/*
 	 * Ram is setup, size stored in gd !!
 	 */
-	debug ("ramsize: %08lX\n", gd->ram_size);
+	debug("ramsize: %08lX\n", gd->ram_size);
 #if defined(CONFIG_SYS_MEM_TOP_HIDE)
 	/*
 	 * Subtract specified amount of memory to hide so that it won't
@@ -312,7 +314,8 @@ void board_init_f (ulong bootflag)
 #ifndef CONFIG_ALT_LB_ADDR
 	/* reserve kernel log buffer */
 	addr -= (LOGBUFF_RESERVE);
-	debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr);
+	debug("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN,
+		addr);
 #endif
 #endif
 
@@ -320,10 +323,11 @@ void board_init_f (ulong bootflag)
 	/*
 	 * reserve protected RAM
 	 */
-	i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
-	reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
+	i = getenv_r("pram", (char *)tmp, sizeof(tmp));
+	reg = (i > 0) ? simple_strtoul((const char *)tmp, NULL, 10) :
+		CONFIG_PRAM;
 	addr -= (reg << 10);		/* size is in kB */
-	debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
+	debug("Reserving %ldk for protected RAM@%08lx\n", reg, addr);
 #endif /* CONFIG_PRAM */
 
 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
@@ -334,19 +338,19 @@ void board_init_f (ulong bootflag)
 	addr &= ~(0x10000 - 1);
 
 	gd->tlb_addr = addr;
-	debug ("TLB table at: %08lx\n", addr);
+	debug("TLB table at: %08lx\n", addr);
 #endif
 
 	/* round down to next 4 kB limit */
 	addr &= ~(4096 - 1);
-	debug ("Top of RAM usable for U-Boot at: %08lx\n", addr);
+	debug("Top of RAM usable for U-Boot at: %08lx\n", addr);
 
 #ifdef CONFIG_LCD
 #ifdef CONFIG_FB_ADDR
 	gd->fb_base = CONFIG_FB_ADDR;
 #else
 	/* reserve memory for LCD display (always full pages) */
-	addr = lcd_setmem (addr);
+	addr = lcd_setmem(addr);
 	gd->fb_base = addr;
 #endif /* CONFIG_FB_ADDR */
 #endif /* CONFIG_LCD */
@@ -358,14 +362,14 @@ void board_init_f (ulong bootflag)
 	addr -= gd->mon_len;
 	addr &= ~(4096 - 1);
 
-	debug ("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, addr);
+	debug("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, addr);
 
 #ifndef CONFIG_PRELOADER
 	/*
 	 * reserve memory for malloc() arena
 	 */
 	addr_sp = addr - TOTAL_MALLOC_LEN;
-	debug ("Reserving %dk for malloc() at: %08lx\n",
+	debug("Reserving %dk for malloc() at: %08lx\n",
 			TOTAL_MALLOC_LEN >> 10, addr_sp);
 	/*
 	 * (permanently) allocate a Board Info struct
@@ -374,18 +378,18 @@ void board_init_f (ulong bootflag)
 	addr_sp -= sizeof (bd_t);
 	bd = (bd_t *) addr_sp;
 	gd->bd = bd;
-	debug ("Reserving %zu Bytes for Board Info at: %08lx\n",
+	debug("Reserving %zu Bytes for Board Info at: %08lx\n",
 			sizeof (bd_t), addr_sp);
 	addr_sp -= sizeof (gd_t);
 	id = (gd_t *) addr_sp;
-	debug ("Reserving %zu Bytes for Global Data at: %08lx\n",
+	debug("Reserving %zu Bytes for Global Data at: %08lx\n",
 			sizeof (gd_t), addr_sp);
 
 	/* setup stackpointer for exeptions */
 	gd->irq_sp = addr_sp;
 #ifdef CONFIG_USE_IRQ
 	addr_sp -= (CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ);
-	debug ("Reserving %zu Bytes for IRQ stack at: %08lx\n",
+	debug("Reserving %zu Bytes for IRQ stack at: %08lx\n",
 		CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ, addr_sp);
 #endif
 	/* leave 3 words for abort-stack    */
@@ -398,11 +402,11 @@ void board_init_f (ulong bootflag)
 	gd->irq_sp = addr_sp;
 #endif
 
-	debug ("New Stack Pointer is: %08lx\n", addr_sp);
+	debug("New Stack Pointer is: %08lx\n", addr_sp);
 
 #ifdef CONFIG_POST
 	post_bootmode_init();
-	post_run (NULL, POST_ROM | post_bootmode_get(0));
+	post_run(NULL, POST_ROM | post_bootmode_get(0));
 #endif
 
 	gd->bd->bi_baudrate = gd->baudrate;
@@ -413,10 +417,10 @@ void board_init_f (ulong bootflag)
 	gd->relocaddr = addr;
 	gd->start_addr_sp = addr_sp;
 	gd->reloc_off = addr - _TEXT_BASE;
-	debug ("relocation Offset is: %08lx\n", gd->reloc_off);
-	memcpy (id, (void *)gd, sizeof (gd_t));
+	debug("relocation Offset is: %08lx\n", gd->reloc_off);
+	memcpy(id, (void *)gd, sizeof(gd_t));
 
-	relocate_code (addr_sp, id, addr);
+	relocate_code(addr_sp, id, addr);
 
 	/* NOTREACHED - relocate_code() does not return */
 }
@@ -425,7 +429,8 @@ void board_init_f (ulong bootflag)
 static char *failed = "*** failed ***\n";
 #endif
 
-/************************************************************************
+/*
+ ************************************************************************
  *
  * This is the next part if the initialization sequence: we are now
  * running from RAM and have a "normal" C environment, i. e. global
@@ -435,7 +440,7 @@ static char *failed = "*** failed ***\n";
  ************************************************************************
  */
 
-void board_init_r (gd_t *id, ulong dest_addr)
+void board_init_r(gd_t *id, ulong dest_addr)
 {
 	char *s;
 	bd_t *bd;
@@ -456,20 +461,20 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	 */
 	dcache_enable();
 
-	debug ("monitor flash len: %08lX\n", monitor_flash_len);
+	debug("monitor flash len: %08lX\n", monitor_flash_len);
 	board_init();	/* Setup chipselects */
 
 #ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
 #endif
 
-	debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
+	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
 #ifdef CONFIG_LOGBUFFER
-	logbuff_init_ptrs ();
+	logbuff_init_ptrs();
 #endif
 #ifdef CONFIG_POST
-	post_output_backlog ();
+	post_output_backlog();
 #endif
 
 	/* The Malloc area is immediately below the monitor copy in DRAM */
@@ -477,34 +482,35 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
 
 #if !defined(CONFIG_SYS_NO_FLASH)
-	puts ("Flash: ");
+	puts("Flash: ");
 
-	if ((flash_size = flash_init ()) > 0) {
+	flash_size = flash_init();
+	if (flash_size > 0) {
 # ifdef CONFIG_SYS_FLASH_CHECKSUM
-		print_size (flash_size, "");
+		print_size(flash_size, "");
 		/*
 		 * Compute and print flash CRC if flashchecksum is set to 'y'
 		 *
 		 * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
 		 */
-		s = getenv ("flashchecksum");
+		s = getenv("flashchecksum");
 		if (s && (*s == 'y')) {
-			printf ("  CRC: %08X",
-				crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size)
-			);
+			printf("  CRC: %08X", crc32(0,
+				(const unsigned char *) CONFIG_SYS_FLASH_BASE,
+				flash_size));
 		}
-		putc ('\n');
+		putc('\n');
 # else	/* !CONFIG_SYS_FLASH_CHECKSUM */
-		print_size (flash_size, "\n");
+		print_size(flash_size, "\n");
 # endif /* CONFIG_SYS_FLASH_CHECKSUM */
 	} else {
-		puts (failed);
-		hang ();
+		puts(failed);
+		hang();
 	}
 #endif
 
 #if defined(CONFIG_CMD_NAND)
-	puts ("NAND:  ");
+	puts("NAND:  ");
 	nand_init();		/* go init the NAND */
 #endif
 
@@ -523,44 +529,44 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 
 	/* initialize environment */
-	env_relocate ();
+	env_relocate();
 
 #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
 	arm_pci_init();
 #endif
 
 	/* IP Address */
-	gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
+	gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
 
-	stdio_init ();	/* get the devices list going. */
+	stdio_init();	/* get the devices list going. */
 
-	jumptable_init ();
+	jumptable_init();
 
 #if defined(CONFIG_API)
 	/* Initialize API */
-	api_init ();
+	api_init();
 #endif
 
-	console_init_r ();	/* fully init console as a device */
+	console_init_r();	/* fully init console as a device */
 
 #if defined(CONFIG_ARCH_MISC_INIT)
 	/* miscellaneous arch dependent initialisations */
-	arch_misc_init ();
+	arch_misc_init();
 #endif
 #if defined(CONFIG_MISC_INIT_R)
 	/* miscellaneous platform dependent initialisations */
-	misc_init_r ();
+	misc_init_r();
 #endif
 
 	 /* set up exceptions */
-	interrupt_init ();
+	interrupt_init();
 	/* enable exceptions */
-	enable_interrupts ();
+	enable_interrupts();
 
 	/* Perform network card initialisation if necessary */
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
-	if (getenv ("ethaddr")) {
+	if (getenv("ethaddr")) {
 		uchar enetaddr[6];
 		eth_getenv_enetaddr("ethaddr", enetaddr);
 		smc_set_mac_addr(enetaddr);
@@ -568,17 +574,17 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */
 
 	/* Initialize from environment */
-	if ((s = getenv ("loadaddr")) != NULL) {
-		load_addr = simple_strtoul (s, NULL, 16);
-	}
+	s = getenv("loadaddr");
+	if (s != NULL)
+		load_addr = simple_strtoul(s, NULL, 16);
 #if defined(CONFIG_CMD_NET)
-	if ((s = getenv ("bootfile")) != NULL) {
-		copy_filename (BootFile, s, sizeof (BootFile));
-	}
+	s = getenv("bootfile");
+	if (s != NULL)
+		copy_filename(BootFile, s, sizeof(BootFile));
 #endif
 
 #ifdef BOARD_LATE_INIT
-	board_late_init ();
+	board_late_init();
 #endif
 
 #ifdef CONFIG_BITBANGMII
@@ -586,17 +592,17 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
-	puts ("Net:   ");
+	puts("Net:   ");
 #endif
 	eth_initialize(gd->bd);
 #if defined(CONFIG_RESET_PHY_R)
-	debug ("Reset Ethernet PHY\n");
+	debug("Reset Ethernet PHY\n");
 	reset_phy();
 #endif
 #endif
 
 #ifdef CONFIG_POST
-	post_run (NULL, POST_RAM | post_bootmode_get(0));
+	post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif
 
 #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
@@ -610,35 +616,35 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #ifdef CONFIG_PRAM
 		char *s;
 
-		if ((s = getenv ("pram")) != NULL) {
-			pram = simple_strtoul (s, NULL, 10);
-		} else {
+		s = getenv("pram");
+		if (s != NULL)
+			pram = simple_strtoul(s, NULL, 10);
+		else
 			pram = CONFIG_PRAM;
-		}
 #else
-		pram=0;
+		pram = 0;
 #endif
 #ifdef CONFIG_LOGBUFFER
 #ifndef CONFIG_ALT_LB_ADDR
 		/* Also take the logbuffer into account (pram is in kB) */
-		pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
+		pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 #endif
 #endif
-		sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
-		setenv ("mem", (char *)memsz);
+		sprintf((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
+		setenv("mem", (char *)memsz);
 	}
 #endif
 
 	/* main_loop() can return to retry autoboot, if so just run it again. */
 	for (;;) {
-		main_loop ();
+		main_loop();
 	}
 
 	/* NOTREACHED - no way out of command loop except booting */
 }
 
-void hang (void)
+void hang(void)
 {
-	puts ("### ERROR ### Please RESET the board ###\n");
+	puts("### ERROR ### Please RESET the board ###\n");
 	for (;;);
 }
Signature · 1 line
1.7.6
#7 lore raw

PATCH v2 1/2 cosmetic: arm: libboard.c: Coding Style cleanup

Dear Heiko Schocher,

Quoted 15 lines · In message <[email protected]> you wrote:

---
changes for v2:
Added Acked-by from Detlev Zundel
Added comments from Albert Aribaud:
- fixed some Codingstyle issues
- changed subject title
Added comment from macpaul at gmail.com:
- Add cosmetic to subject title

Quoted 2 lines
 arch/arm/lib/board.c |  216 ++++++++++++++++++++++++++------------------------
 1 files changed, 111 insertions(+), 105 deletions(-)

Sorry, but "libboard.c" appears to be wrong. Should this not be "lib/board.c" instead?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The philosophy exam was a piece of cake  -  which  was  a  bit  of  a
surprise, actually, because I was expecting some questions on a sheet
of paper.
#8 lore raw

PATCH v2 1/2 cosmetic: arm: libboard.c: Coding Style cleanup

Hello Wolfgang,

Quoted 18 lines · Wolfgang Denk

Dear Heiko Schocher,

Quoted 15 lines · In message <[email protected]> you wrote:

---
changes for v2:
Added Acked-by from Detlev Zundel
Added comments from Albert Aribaud:
- fixed some Codingstyle issues
- changed subject title
Added comment from macpaul at gmail.com:
- Add cosmetic to subject title

Quoted 5 lines
Quoted 2 lines
 arch/arm/lib/board.c |  216 ++++++++++++++++++++++++++------------------------
 1 files changed, 111 insertions(+), 105 deletions(-)

Sorry, but "libboard.c" appears to be wrong. Should this not be "lib/board.c" instead?

Hehe, you are right, I just copy&pasted from Alberts comment ;-)

Fixed! (waiting for some more coments before posting v3)

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#9 lore raw

PATCH v3 1/2 cosmetic: arm: lib/board.c: Coding Style cleanup

In reply to Heiko Schocher

---
changes for v2:
Added Acked-by from Detlev Zundel
Added comments from Albert Aribaud:
- fixed some Codingstyle issues
- changed subject title
Added comment from macpaul at gmail.com:
- Add cosmetic to subject title

changes for v3:
Added comment from Wolfgang Denk:
- fix copy&paste error in subject title

 arch/arm/lib/board.c |  216 ++++++++++++++++++++++++++------------------------
 1 files changed, 111 insertions(+), 105 deletions(-)
arch/arm/lib/board.c +111 -105
index fc52a26..8b11eb1 100644
@@ -92,26 +92,28 @@ extern void rtl8019_get_enetaddr (uchar * addr);
  ************************************************************************
  * May be supplied by boards if desired
  */
-void inline __coloured_LED_init (void) {}
-void coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
-void inline __red_LED_on (void) {}
-void red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
-void inline __red_LED_off(void) {}
+inline void __coloured_LED_init(void) {}
+void coloured_LED_init(void)
+	__attribute__((weak, alias("__coloured_LED_init")));
+inline void __red_LED_on(void) {}
+void red_LED_on(void) __attribute__((weak, alias("__red_LED_on")));
+inline void __red_LED_off(void) {}
 void red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
-void inline __green_LED_on(void) {}
+inline void __green_LED_on(void) {}
 void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
-void inline __green_LED_off(void) {}
+inline void __green_LED_off(void) {}
 void green_LED_off(void) __attribute__((weak, alias("__green_LED_off")));
-void inline __yellow_LED_on(void) {}
+inline void __yellow_LED_on(void) {}
 void yellow_LED_on(void) __attribute__((weak, alias("__yellow_LED_on")));
-void inline __yellow_LED_off(void) {}
+inline void __yellow_LED_off(void) {}
 void yellow_LED_off(void) __attribute__((weak, alias("__yellow_LED_off")));
-void inline __blue_LED_on(void) {}
+inline void __blue_LED_on(void) {}
 void blue_LED_on(void) __attribute__((weak, alias("__blue_LED_on")));
-void inline __blue_LED_off(void) {}
+inline void __blue_LED_off(void) {}
 void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 
-/************************************************************************
+/*
+ ************************************************************************
  * Init Utilities							*
  ************************************************************************
  * Some of this code should be moved into the core functions,
@@ -122,30 +124,30 @@ void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 #if defined(CONFIG_ARM_DCC) && !defined(CONFIG_BAUDRATE)
 #define CONFIG_BAUDRATE 115200
 #endif
-static int init_baudrate (void)
+static int init_baudrate(void)
 {
 	char tmp[64];	/* long enough for environment variables */
-	int i = getenv_f("baudrate", tmp, sizeof (tmp));
+	int i = getenv_f("baudrate", tmp, sizeof(tmp));
 
 	gd->baudrate = (i > 0)
-			? (int) simple_strtoul (tmp, NULL, 10)
+			? (int) simple_strtoul(tmp, NULL, 10)
 			: CONFIG_BAUDRATE;
 
 	return (0);
 }
 
-static int display_banner (void)
+static int display_banner(void)
 {
-	printf ("\n\n%s\n\n", version_string);
-	debug ("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
+	printf("\n\n%s\n\n", version_string);
+	debug("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
 	       _TEXT_BASE,
-	       _bss_start_ofs+_TEXT_BASE, _bss_end_ofs+_TEXT_BASE);
+	       _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE);
 #ifdef CONFIG_MODEM_SUPPORT
-	debug ("Modem Support enabled\n");
+	debug("Modem Support enabled\n");
 #endif
 #ifdef CONFIG_USE_IRQ
-	debug ("IRQ Stack: %08lx\n", IRQ_STACK_START);
-	debug ("FIQ Stack: %08lx\n", FIQ_STACK_START);
+	debug("IRQ Stack: %08lx\n", IRQ_STACK_START);
+	debug("FIQ Stack: %08lx\n", FIQ_STACK_START);
 #endif
 
 	return (0);
@@ -158,23 +160,23 @@ static int display_banner (void)
  * gives a simple yet clear indication which part of the
  * initialization if failing.
  */
-static int display_dram_config (void)
+static int display_dram_config(void)
 {
 	int i;
 
 #ifdef DEBUG
-	puts ("RAM Configuration:\n");
+	puts("RAM Configuration:\n");
 
-	for(i=0; i<CONFIG_NR_DRAM_BANKS; i++) {
-		printf ("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
-		print_size (gd->bd->bi_dram[i].size, "\n");
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		printf("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
+		print_size(gd->bd->bi_dram[i].size, "\n");
 	}
 #else
 	ulong size = 0;
 
-	for (i=0; i<CONFIG_NR_DRAM_BANKS; i++) {
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
 		size += gd->bd->bi_dram[i].size;
-	}
+
 	puts("DRAM:  ");
 	print_size(size, "\n");
 #endif
@@ -183,11 +185,11 @@ static int display_dram_config (void)
 }
 
 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
-static int init_func_i2c (void)
+static int init_func_i2c(void)
 {
-	puts ("I2C:   ");
-	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-	puts ("ready\n");
+	puts("I2C:   ");
+	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	puts("ready\n");
 	return (0);
 }
 #endif
@@ -226,7 +228,7 @@ static int arm_pci_init(void)
  */
 typedef int (init_fnc_t) (void);
 
-int print_cpuinfo (void);
+int print_cpuinfo(void);
 
 void __dram_init_banksize(void)
 {
@@ -265,7 +267,7 @@ init_fnc_t *init_sequence[] = {
 	NULL,
 };
 
-void board_init_f (ulong bootflag)
+void board_init_f(ulong bootflag)
 {
 	bd_t *bd;
 	init_fnc_t **init_fnc_ptr;
@@ -277,7 +279,7 @@ void board_init_f (ulong bootflag)
 	/* compiler optimization barrier needed for GCC >= 3.4 */
 	__asm__ __volatile__("": : :"memory");
 
-	memset ((void*)gd, 0, sizeof (gd_t));
+	memset((void *)gd, 0, sizeof(gd_t));
 
 	gd->mon_len = _bss_end_ofs;
 
@@ -287,11 +289,11 @@ void board_init_f (ulong bootflag)
 		}
 	}
 
-	debug ("monitor len: %08lX\n", gd->mon_len);
+	debug("monitor len: %08lX\n", gd->mon_len);
 	/*
 	 * Ram is setup, size stored in gd !!
 	 */
-	debug ("ramsize: %08lX\n", gd->ram_size);
+	debug("ramsize: %08lX\n", gd->ram_size);
 #if defined(CONFIG_SYS_MEM_TOP_HIDE)
 	/*
 	 * Subtract specified amount of memory to hide so that it won't
@@ -312,7 +314,8 @@ void board_init_f (ulong bootflag)
 #ifndef CONFIG_ALT_LB_ADDR
 	/* reserve kernel log buffer */
 	addr -= (LOGBUFF_RESERVE);
-	debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr);
+	debug("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN,
+		addr);
 #endif
 #endif
 
@@ -320,10 +323,11 @@ void board_init_f (ulong bootflag)
 	/*
 	 * reserve protected RAM
 	 */
-	i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
-	reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
+	i = getenv_r("pram", (char *)tmp, sizeof(tmp));
+	reg = (i > 0) ? simple_strtoul((const char *)tmp, NULL, 10) :
+		CONFIG_PRAM;
 	addr -= (reg << 10);		/* size is in kB */
-	debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
+	debug("Reserving %ldk for protected RAM@%08lx\n", reg, addr);
 #endif /* CONFIG_PRAM */
 
 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
@@ -334,19 +338,19 @@ void board_init_f (ulong bootflag)
 	addr &= ~(0x10000 - 1);
 
 	gd->tlb_addr = addr;
-	debug ("TLB table at: %08lx\n", addr);
+	debug("TLB table at: %08lx\n", addr);
 #endif
 
 	/* round down to next 4 kB limit */
 	addr &= ~(4096 - 1);
-	debug ("Top of RAM usable for U-Boot at: %08lx\n", addr);
+	debug("Top of RAM usable for U-Boot at: %08lx\n", addr);
 
 #ifdef CONFIG_LCD
 #ifdef CONFIG_FB_ADDR
 	gd->fb_base = CONFIG_FB_ADDR;
 #else
 	/* reserve memory for LCD display (always full pages) */
-	addr = lcd_setmem (addr);
+	addr = lcd_setmem(addr);
 	gd->fb_base = addr;
 #endif /* CONFIG_FB_ADDR */
 #endif /* CONFIG_LCD */
@@ -358,14 +362,14 @@ void board_init_f (ulong bootflag)
 	addr -= gd->mon_len;
 	addr &= ~(4096 - 1);
 
-	debug ("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, addr);
+	debug("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, addr);
 
 #ifndef CONFIG_PRELOADER
 	/*
 	 * reserve memory for malloc() arena
 	 */
 	addr_sp = addr - TOTAL_MALLOC_LEN;
-	debug ("Reserving %dk for malloc() at: %08lx\n",
+	debug("Reserving %dk for malloc() at: %08lx\n",
 			TOTAL_MALLOC_LEN >> 10, addr_sp);
 	/*
 	 * (permanently) allocate a Board Info struct
@@ -374,18 +378,18 @@ void board_init_f (ulong bootflag)
 	addr_sp -= sizeof (bd_t);
 	bd = (bd_t *) addr_sp;
 	gd->bd = bd;
-	debug ("Reserving %zu Bytes for Board Info at: %08lx\n",
+	debug("Reserving %zu Bytes for Board Info at: %08lx\n",
 			sizeof (bd_t), addr_sp);
 	addr_sp -= sizeof (gd_t);
 	id = (gd_t *) addr_sp;
-	debug ("Reserving %zu Bytes for Global Data at: %08lx\n",
+	debug("Reserving %zu Bytes for Global Data at: %08lx\n",
 			sizeof (gd_t), addr_sp);
 
 	/* setup stackpointer for exeptions */
 	gd->irq_sp = addr_sp;
 #ifdef CONFIG_USE_IRQ
 	addr_sp -= (CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ);
-	debug ("Reserving %zu Bytes for IRQ stack at: %08lx\n",
+	debug("Reserving %zu Bytes for IRQ stack at: %08lx\n",
 		CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ, addr_sp);
 #endif
 	/* leave 3 words for abort-stack    */
@@ -398,11 +402,11 @@ void board_init_f (ulong bootflag)
 	gd->irq_sp = addr_sp;
 #endif
 
-	debug ("New Stack Pointer is: %08lx\n", addr_sp);
+	debug("New Stack Pointer is: %08lx\n", addr_sp);
 
 #ifdef CONFIG_POST
 	post_bootmode_init();
-	post_run (NULL, POST_ROM | post_bootmode_get(0));
+	post_run(NULL, POST_ROM | post_bootmode_get(0));
 #endif
 
 	gd->bd->bi_baudrate = gd->baudrate;
@@ -413,10 +417,10 @@ void board_init_f (ulong bootflag)
 	gd->relocaddr = addr;
 	gd->start_addr_sp = addr_sp;
 	gd->reloc_off = addr - _TEXT_BASE;
-	debug ("relocation Offset is: %08lx\n", gd->reloc_off);
-	memcpy (id, (void *)gd, sizeof (gd_t));
+	debug("relocation Offset is: %08lx\n", gd->reloc_off);
+	memcpy(id, (void *)gd, sizeof(gd_t));
 
-	relocate_code (addr_sp, id, addr);
+	relocate_code(addr_sp, id, addr);
 
 	/* NOTREACHED - relocate_code() does not return */
 }
@@ -425,7 +429,8 @@ void board_init_f (ulong bootflag)
 static char *failed = "*** failed ***\n";
 #endif
 
-/************************************************************************
+/*
+ ************************************************************************
  *
  * This is the next part if the initialization sequence: we are now
  * running from RAM and have a "normal" C environment, i. e. global
@@ -435,7 +440,7 @@ static char *failed = "*** failed ***\n";
  ************************************************************************
  */
 
-void board_init_r (gd_t *id, ulong dest_addr)
+void board_init_r(gd_t *id, ulong dest_addr)
 {
 	char *s;
 	bd_t *bd;
@@ -456,20 +461,20 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	 */
 	dcache_enable();
 
-	debug ("monitor flash len: %08lX\n", monitor_flash_len);
+	debug("monitor flash len: %08lX\n", monitor_flash_len);
 	board_init();	/* Setup chipselects */
 
 #ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
 #endif
 
-	debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
+	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
 #ifdef CONFIG_LOGBUFFER
-	logbuff_init_ptrs ();
+	logbuff_init_ptrs();
 #endif
 #ifdef CONFIG_POST
-	post_output_backlog ();
+	post_output_backlog();
 #endif
 
 	/* The Malloc area is immediately below the monitor copy in DRAM */
@@ -477,34 +482,35 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
 
 #if !defined(CONFIG_SYS_NO_FLASH)
-	puts ("Flash: ");
+	puts("Flash: ");
 
-	if ((flash_size = flash_init ()) > 0) {
+	flash_size = flash_init();
+	if (flash_size > 0) {
 # ifdef CONFIG_SYS_FLASH_CHECKSUM
-		print_size (flash_size, "");
+		print_size(flash_size, "");
 		/*
 		 * Compute and print flash CRC if flashchecksum is set to 'y'
 		 *
 		 * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
 		 */
-		s = getenv ("flashchecksum");
+		s = getenv("flashchecksum");
 		if (s && (*s == 'y')) {
-			printf ("  CRC: %08X",
-				crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size)
-			);
+			printf("  CRC: %08X", crc32(0,
+				(const unsigned char *) CONFIG_SYS_FLASH_BASE,
+				flash_size));
 		}
-		putc ('\n');
+		putc('\n');
 # else	/* !CONFIG_SYS_FLASH_CHECKSUM */
-		print_size (flash_size, "\n");
+		print_size(flash_size, "\n");
 # endif /* CONFIG_SYS_FLASH_CHECKSUM */
 	} else {
-		puts (failed);
-		hang ();
+		puts(failed);
+		hang();
 	}
 #endif
 
 #if defined(CONFIG_CMD_NAND)
-	puts ("NAND:  ");
+	puts("NAND:  ");
 	nand_init();		/* go init the NAND */
 #endif
 
@@ -523,44 +529,44 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 
 	/* initialize environment */
-	env_relocate ();
+	env_relocate();
 
 #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
 	arm_pci_init();
 #endif
 
 	/* IP Address */
-	gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
+	gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
 
-	stdio_init ();	/* get the devices list going. */
+	stdio_init();	/* get the devices list going. */
 
-	jumptable_init ();
+	jumptable_init();
 
 #if defined(CONFIG_API)
 	/* Initialize API */
-	api_init ();
+	api_init();
 #endif
 
-	console_init_r ();	/* fully init console as a device */
+	console_init_r();	/* fully init console as a device */
 
 #if defined(CONFIG_ARCH_MISC_INIT)
 	/* miscellaneous arch dependent initialisations */
-	arch_misc_init ();
+	arch_misc_init();
 #endif
 #if defined(CONFIG_MISC_INIT_R)
 	/* miscellaneous platform dependent initialisations */
-	misc_init_r ();
+	misc_init_r();
 #endif
 
 	 /* set up exceptions */
-	interrupt_init ();
+	interrupt_init();
 	/* enable exceptions */
-	enable_interrupts ();
+	enable_interrupts();
 
 	/* Perform network card initialisation if necessary */
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
-	if (getenv ("ethaddr")) {
+	if (getenv("ethaddr")) {
 		uchar enetaddr[6];
 		eth_getenv_enetaddr("ethaddr", enetaddr);
 		smc_set_mac_addr(enetaddr);
@@ -568,17 +574,17 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */
 
 	/* Initialize from environment */
-	if ((s = getenv ("loadaddr")) != NULL) {
-		load_addr = simple_strtoul (s, NULL, 16);
-	}
+	s = getenv("loadaddr");
+	if (s != NULL)
+		load_addr = simple_strtoul(s, NULL, 16);
 #if defined(CONFIG_CMD_NET)
-	if ((s = getenv ("bootfile")) != NULL) {
-		copy_filename (BootFile, s, sizeof (BootFile));
-	}
+	s = getenv("bootfile");
+	if (s != NULL)
+		copy_filename(BootFile, s, sizeof(BootFile));
 #endif
 
 #ifdef BOARD_LATE_INIT
-	board_late_init ();
+	board_late_init();
 #endif
 
 #ifdef CONFIG_BITBANGMII
@@ -586,17 +592,17 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
-	puts ("Net:   ");
+	puts("Net:   ");
 #endif
 	eth_initialize(gd->bd);
 #if defined(CONFIG_RESET_PHY_R)
-	debug ("Reset Ethernet PHY\n");
+	debug("Reset Ethernet PHY\n");
 	reset_phy();
 #endif
 #endif
 
 #ifdef CONFIG_POST
-	post_run (NULL, POST_RAM | post_bootmode_get(0));
+	post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif
 
 #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
@@ -610,35 +616,35 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #ifdef CONFIG_PRAM
 		char *s;
 
-		if ((s = getenv ("pram")) != NULL) {
-			pram = simple_strtoul (s, NULL, 10);
-		} else {
+		s = getenv("pram");
+		if (s != NULL)
+			pram = simple_strtoul(s, NULL, 10);
+		else
 			pram = CONFIG_PRAM;
-		}
 #else
-		pram=0;
+		pram = 0;
 #endif
 #ifdef CONFIG_LOGBUFFER
 #ifndef CONFIG_ALT_LB_ADDR
 		/* Also take the logbuffer into account (pram is in kB) */
-		pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
+		pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 #endif
 #endif
-		sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
-		setenv ("mem", (char *)memsz);
+		sprintf((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
+		setenv("mem", (char *)memsz);
 	}
 #endif
 
 	/* main_loop() can return to retry autoboot, if so just run it again. */
 	for (;;) {
-		main_loop ();
+		main_loop();
 	}
 
 	/* NOTREACHED - no way out of command loop except booting */
 }
 
-void hang (void)
+void hang(void)
 {
-	puts ("### ERROR ### Please RESET the board ###\n");
+	puts("### ERROR ### Please RESET the board ###\n");
 	for (;;);
 }
Signature · 1 line
1.7.6
#10 lore raw

PATCH 1/2 arm, lib/board.c: Coding Style cleanup

In reply to Heiko Schocher

Dear Albert,

In message <[email protected]> Heiko

Quoted 5 lines · Schocher
---
 arch/arm/lib/board.c |  218 ++++++++++++++++++++++++++------------------------
 1 files changed, 113 insertions(+), 105 deletions(-)

This is a cosmetic patch (Coding Style cleanup) only. Are you going to take it?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Looks clean and obviously correct to me, but then _everything_ I
write always looks obviously correct to me.  - Linus Torvalds in
<[email protected]>
#11 lore raw

PATCH 1/2 arm, lib/board.c: Coding Style cleanup

Hi Wolfgang,

Quoted 4 lines · Wolfgang Denk

Dear Albert,

In message<[email protected]> Heiko Schocher wrote:

Quoted 8 lines
Quoted 5 lines
---
  arch/arm/lib/board.c |  218 ++++++++++++++++++++++++++------------------------
  1 files changed, 113 insertions(+), 105 deletions(-)

This is a cosmetic patch (Coding Style cleanup) only. Are you going to take it?

As it was originated within the merge window:

Applied to u-boot-arm/master, manually in one place where context had changed (CONFIG_PRELOADER has become CONFIG_SPL_BUILD).

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.
#12 lore raw

PATCH 2/2 arm, lib/board.c: use gd->ram_size instead of bd->bi_memsize

In reply to Heiko Schocher
---
 arch/arm/lib/board.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/lib/board.c +1 -1
index 05ee71b..0acd23b 100644
@@ -641,7 +641,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 		pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 #endif
 #endif
-		sprintf((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
+		sprintf((char *)memsz, "%ldk", (gd->ram_size / 1024) - pram);
 		setenv("mem", (char *)memsz);
 	}
 #endif
Signature · 1 line
1.7.4.4
#13 lore raw

PATCH 2/2 arm, lib/board.c: use gd->ram_size instead of bd->bi_memsize

Hello Albert,

Quoted 5 lines · Heiko Schocher
---
 arch/arm/lib/board.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Could you apply this patch also, as it is in the same patchserie as the already apllied patch:

http://patchwork.ozlabs.org/patch/104932/

It fixes a compilererror, if CONFIG_LOGBUFFER is activated.

Thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#14 lore raw

PATCH 2/2 arm, lib/board.c: use gd->ram_size instead of bd->bi_memsize

In reply to Heiko Schocher

Hi Heiko,

Le 03/06/2011 10:11, Heiko Schocher a ?crit :

Quoted 11 lines
---
  arch/arm/lib/board.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/lib/board.c +0 -0
index 05ee71b..0acd23b 100644

arch/arm/lib/board.c void board_init_r(gd_t *id, ulong dest_addr) · line 647

Quoted 8 lines
arch/arm/lib/board.c +1 -1
@@ -641,7 +641,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
  		pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
  #endif
  #endif
-		sprintf((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
+		sprintf((char *)memsz, "%ldk", (gd->ram_size / 1024) - pram);
  		setenv("mem", (char *)memsz);
  	}
  #endif

Applied to u-boot-arm/master, thanks!

Amicalement,

Signature · 1 line
Albert.