[U-Boot] [PATCH ARM 3/4] s3c24x0 code-style clean-up

kevin.morfitt at fearnside-systems.co.uk kevin.morfitt at fearnside-systems.co.uk
Mon Dec 28 23:49:44 CET 2009


Changes the s3c24x0 files to meet the code style requirements.

Signed-off-by: Kevin Morfitt <kevin.morfitt at fearnside-systems.co.uk>
---

checkpatch.pl reports no errors.

 board/MAI/AmigaOneG3SE/video.c    |    1 -
 board/mpl/common/common_util.h    |    1 +
 board/mpl/common/flash.c          |    1 -
 board/mpl/vcma9/cmd_vcma9.c       |    9 -
 board/mpl/vcma9/vcma9.c           |   27 ++--
 board/mpl/vcma9/vcma9.h           |    6 +-
 board/samsung/smdk2400/smdk2400.c |   12 +-
 board/sbc2410x/sbc2410x.c         |    6 +-
 board/trab/auto_update.c          |   30 +---
 board/trab/cmd_trab.c             |  213 +++++++++++-------------
 board/trab/rs485.c                |   16 +-
 board/trab/trab.c                 |   43 ++---
 board/trab/trab.h                 |   38 +++++
 board/trab/trab_fkt.c             |  331 ++++++++++++++++---------------------
 board/trab/tsc2000.c              |   12 +-
 board/trab/tsc2000.h              |    1 +
 board/trab/vfd.c                  |   70 ++++----
 common/cmd_version.c              |    2 -
 common/cmd_vfd.c                  |    2 -
 common/main.c                     |    5 +-
 drivers/i2c/s3c24x0_i2c.c         |   71 ++++-----
 drivers/video/cfb_console.c       |    1 -
 include/common.h                  |   14 ++
 lib_generic/display_options.c     |    2 -
 24 files changed, 418 insertions(+), 496 deletions(-)
 create mode 100644 board/trab/trab.h

diff --git a/board/MAI/AmigaOneG3SE/video.c b/board/MAI/AmigaOneG3SE/video.c
index e24e28b..e8d1f64 100644
--- a/board/MAI/AmigaOneG3SE/video.c
+++ b/board/MAI/AmigaOneG3SE/video.c
@@ -478,7 +478,6 @@ void video_easteregg(void)
 #endif
 
 extern block_dev_desc_t * ide_get_dev(int dev);
-extern char version_string[];
 
 void video_banner(void)
 {
diff --git a/board/mpl/common/common_util.h b/board/mpl/common/common_util.h
index 29cd14f..9978ce4 100644
--- a/board/mpl/common/common_util.h
+++ b/board/mpl/common/common_util.h
@@ -42,4 +42,5 @@ void check_env(void);
 void doc_init (void);
 #endif
 
+int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 #endif /* _COMMON_UTIL_H_ */
diff --git a/board/mpl/common/flash.c b/board/mpl/common/flash.c
index 682f0e7..2e40610 100644
--- a/board/mpl/common/flash.c
+++ b/board/mpl/common/flash.c
@@ -159,7 +159,6 @@ unsigned long flash_init (void)
 #if !defined(CONFIG_PATI)
 	unsigned long size_b1,flashcr,size_reg;
 	int mode;
-	extern char version_string;
 	char *p = &version_string;
 
 	/* Since we are relocated, we can set-up the CS finally */
diff --git a/board/mpl/vcma9/cmd_vcma9.c b/board/mpl/vcma9/cmd_vcma9.c
index 49558d8..10dcd8e 100644
--- a/board/mpl/vcma9/cmd_vcma9.c
+++ b/board/mpl/vcma9/cmd_vcma9.c
@@ -43,15 +43,6 @@ static uchar cs8900_chksum(ushort data)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-extern void print_vcma9_info(void);
-extern int vcma9_cantest(int);
-extern int vcma9_nandtest(void);
-extern int vcma9_nanderase(void);
-extern int vcma9_nandread(ulong);
-extern int vcma9_nandwrite(ulong);
-extern int vcma9_dactest(int);
-extern int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-
 /* ------------------------------------------------------------------------- */
 
 int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
index 9a7c0fa..5401664 100644
--- a/board/mpl/vcma9/vcma9.c
+++ b/board/mpl/vcma9/vcma9.c
@@ -137,22 +137,19 @@ int board_init(void)
  * NAND flash initialization.
  */
 #if defined(CONFIG_CMD_NAND)
-extern ulong
-nand_probe(ulong physadr);
-
-
 static inline void NF_Reset(void)
 {
 	int i;
 
 	NF_SetCE(NFCE_LOW);
-	NF_Cmd(0xFF);			/* reset command */
-	for (i = 0; i < 10; i++);	/* tWB = 100ns. */
-	NF_WaitRB();			/* wait 200~500us; */
+	NF_Cmd(0xFF);		/* reset command */
+	/* tWB = 100ns. */
+	for (i = 0; i < 10; i++)
+		/* delay */;
+	NF_WaitRB();		/* wait 200~500us; */
 	NF_SetCE(NFCE_HIGH);
 }
 
-
 static inline void NF_Init(void)
 {
 #define TACLS	0
@@ -187,36 +184,36 @@ static u8 Get_PLD_ID(void)
 {
 	VCMA9_PLD * const pld = VCMA9_get_base_PLD();
 
-	return (pld->ID);
+	return pld->ID;
 }
 
 static u8 Get_PLD_BOARD(void)
 {
 	VCMA9_PLD * const pld = VCMA9_get_base_PLD();
 
-	return (pld->BOARD);
+	return pld->BOARD;
 }
 
 static u8 Get_PLD_SDRAM(void)
 {
 	VCMA9_PLD * const pld = VCMA9_get_base_PLD();
 
-	return (pld->SDRAM);
+	return pld->SDRAM;
 }
 
 static u8 Get_PLD_Version(void)
 {
-	return ((Get_PLD_ID() >> 4) & 0x0F);
+	return (Get_PLD_ID() >> 4) & 0x0F;
 }
 
 static u8 Get_PLD_Revision(void)
 {
-	return (Get_PLD_ID() & 0x0F);
+	return Get_PLD_ID() & 0x0F;
 }
 
 static uchar Get_Board_PCB(void)
 {
-	return (((Get_PLD_BOARD() >> 4) & 0x03) + 'A');
+	return ((Get_PLD_BOARD() >> 4) & 0x03) + 'A';
 }
 
 static u8 Get_SDRAM_ChipNr(void)
@@ -307,7 +304,7 @@ int checkboard(void)
 		s[5] = 0;
 		Show_VCMA9_Info(s, &s[6]);
 	}
-	return (0);
+	return 0;
 }
 
 int last_stage_init(void)
diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
index e1ec1fe..adc7673 100644
--- a/board/mpl/vcma9/vcma9.h
+++ b/board/mpl/vcma9/vcma9.h
@@ -27,7 +27,8 @@
 
 #include <asm/arch/s3c24x0_cpu.h>
 
-extern int mem_test(unsigned long start, unsigned long ramsize, int mode);
+int mem_test(unsigned long start, unsigned long ramsize, int mode);
+int vcma9_cantest(int);
 void print_vcma9_info(void);
 
 #if defined(CONFIG_CMD_NAND)
@@ -81,7 +82,8 @@ static inline void NF_WaitRB(void)
 {
 	struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
-	while (!(nand->NFSTAT & (1 << 0)));
+	while (!(nand->NFSTAT & (1 << 0)))
+		/* Wait */;
 }
 
 static inline void NF_Write(u8 data)
diff --git a/board/samsung/smdk2400/smdk2400.c b/board/samsung/smdk2400/smdk2400.c
index 5825ce9..a1b0e0c 100644
--- a/board/samsung/smdk2400/smdk2400.c
+++ b/board/samsung/smdk2400/smdk2400.c
@@ -33,18 +33,13 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_MODEM_SUPPORT
 static int key_pressed(void);
-int mdm_init (bd_t *);
-extern void disable_putc(void);
-extern void enable_putc(void);
-extern int hwflow_onoff(int);
-extern int do_mdm_init; /* defined in common/main.c */
 #endif /* CONFIG_MODEM_SUPPORT */
 
 /*
  * Miscellaneous platform dependent initialisations
  */
 
-int board_init (void)
+int board_init(void)
 {
 	struct s3c24x0_clock_power * const clk_power =
 					s3c24x0_get_base_clock_power();
@@ -93,7 +88,7 @@ int board_init (void)
 	return 0;
 }
 
-int dram_init (void)
+int dram_init(void)
 {
 	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
 	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
@@ -105,9 +100,8 @@ int dram_init (void)
 static int key_pressed(void)
 {
 	int rc;
-	if (1) {	/* check for button push here, now just return 1 */
+	if (1)	/* check for button push here, now just return 1 */
 		rc = 1;
-	}
 
 	return rc;
 }
diff --git a/board/sbc2410x/sbc2410x.c b/board/sbc2410x/sbc2410x.c
index b7bbcf2..548852f 100644
--- a/board/sbc2410x/sbc2410x.c
+++ b/board/sbc2410x/sbc2410x.c
@@ -86,7 +86,7 @@ int board_init(void)
 	clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
 
 	/* some delay between MPLL and UPLL */
-	delay (4000);
+	delay(4000);
 
 	/* configure UPLL */
 	clk_power->UPLLCON = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV);
@@ -136,7 +136,6 @@ int dram_init(void)
 }
 
 #if defined(CONFIG_CMD_NAND)
-extern ulong nand_probe(ulong physadr);
 
 static inline void NF_Reset(void)
 {
@@ -144,7 +143,8 @@ static inline void NF_Reset(void)
 
 	NF_SetCE(NFCE_LOW);
 	NF_Cmd(0xFF);			/* reset command */
-	for (i = 0; i < 10; i++);	/* tWB = 100ns. */
+	for (i = 0; i < 10; i++)
+		/* tWB = 100ns. */;
 	NF_WaitRB();			/* wait 200~500us; */
 	NF_SetCE(NFCE_HIGH);
 }
diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c
index bcb8505..4f30c23 100644
--- a/board/trab/auto_update.c
+++ b/board/trab/auto_update.c
@@ -27,6 +27,12 @@
 #include <image.h>
 #include <asm/byteorder.h>
 #include <usb.h>
+#include <fat.h>
+#include <i2c.h>
+#include <flash.h>
+#include <asm/arch/s3c24x0_cpu.h>
+#include "tsc2000.h"
+#include "trab.h"
 
 #ifdef CONFIG_SYS_HUSH_PARSER
 #include <hush.h>
@@ -187,24 +193,6 @@ struct flash_layout aufl_layout[AU_MAXFILES - 3] = { \
 /* the app is the largest image */
 #define MAX_LOADSZ ausize[IDX_APP]
 
-/* externals */
-extern int fat_register_device(block_dev_desc_t *, int);
-extern int file_fat_detectfs(void);
-extern long file_fat_read(const char *, void *, unsigned long);
-extern int i2c_read (unsigned char, unsigned int, int , unsigned char* , int);
-extern int i2c_write (uchar, uint, int , uchar* , int);
-#ifdef CONFIG_VFD
-extern int trab_vfd (ulong);
-extern int transfer_pic(unsigned char, unsigned char *, int, int);
-#endif
-extern int flash_sect_erase(ulong, ulong);
-extern int flash_sect_protect (int, ulong, ulong);
-extern int flash_write (char *, ulong, ulong);
-/* change char* to void* to shutup the compiler */
-extern int i2c_write_multiple (uchar, uint, int, void *, int);
-extern int i2c_read_multiple (uchar, uint, int, void *, int);
-extern int u_boot_hush_start(void);
-
 int
 au_check_cksum_valid(int idx, long nbytes)
 {
@@ -442,15 +430,15 @@ au_update_eeprom(int idx)
 	/* write the time field into EEPROM */
 	off = auee_off[idx].time;
 	val = image_get_time (hdr);
-	i2c_write_multiple(0x54, off, 1, &val, sizeof(val));
+	i2c_write_multiple(0x54, off, 1, (uchar *)&val, sizeof(val));
 	/* write the size field into EEPROM */
 	off = auee_off[idx].size;
 	val = image_get_data_size (hdr);
-	i2c_write_multiple(0x54, off, 1, &val, sizeof(val));
+	i2c_write_multiple(0x54, off, 1, (uchar *)&val, sizeof(val));
 	/* write the dcrc field into EEPROM */
 	off = auee_off[idx].dcrc;
 	val = image_get_dcrc (hdr);
-	i2c_write_multiple(0x54, off, 1, &val, sizeof(val));
+	i2c_write_multiple(0x54, off, 1, (uchar *)&val, sizeof(val));
 	/* enable the power switch */
 	*CPLD_VFD_BK &= ~POWER_OFF;
 	return 0;
diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c
index bba9084..2c31d50 100644
--- a/board/trab/cmd_trab.c
+++ b/board/trab/cmd_trab.c
@@ -27,6 +27,9 @@
 #include <command.h>
 #include <asm/arch/s3c24x0_cpu.h>
 #include <rtc.h>
+#include <i2c.h>
+#include "tsc2000.h"
+#include "trab.h"
 
 /*
  * TRAB board specific commands. Especially commands for burn-in and function
@@ -100,23 +103,14 @@
 
 /* misc */
 
-/* externals */
-extern int memory_post_tests(unsigned long start, unsigned long size);
-extern int i2c_write(uchar, uint, int, uchar *, int);
-extern int i2c_read(uchar, uint, int , uchar *, int);
-extern void tsc2000_reg_init(void);
-extern s32 tsc2000_contact_temp(void);
-extern void tsc2000_spi_init(void);
-
 /* function declarations */
-int do_dip(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-int do_vcc5v(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-int do_burn_in(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-int do_contact_temp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-int do_burn_in_status(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-int i2c_write_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len);
-int i2c_read_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len);
-int do_temp_log(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+static int do_dip(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+static int do_vcc5v(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+static int do_burn_in(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+static int do_contact_temp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+static int do_burn_in_status(cmd_tbl_t *cmdtp, int flag, int argc,
+			     char *argv[]);
+static int do_temp_log(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
 /* helper functions */
 static void adc_init(void);
@@ -177,18 +171,18 @@ int do_burn_in(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	if (global_vars_write_to_eeprom() != 0) {
 		printf("%s: error writing global_vars to eeprom\n",
 		       __FUNCTION__);
-		return (1);
+		return 1;
 	}
 
 	if (read_max_cycles() != 0) {
 		printf("%s: error reading max_cycles from eeprom\n",
 		       __FUNCTION__);
-		return (1);
+		return 1;
 	}
 
 	if (max_cycles == 0) {
 		printf("%s: error, burn in max_cycles = 0\n", __FUNCTION__);
-		return (1);
+		return 1;
 	}
 
 	status = 0;
@@ -246,10 +240,10 @@ int do_burn_in(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 	if (status == 0) {
 		led_blink();   /* endless loop!! */
-		return (0);
+		return 0;
 	} else {
 		led_set(0);
-		return (1);
+		return 1;
 	}
 }
 
@@ -269,9 +263,9 @@ int do_dip(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		return 1;
 	}
 
-	if ((dip = read_dip()) == -1) {
+	dip = read_dip();
+	if (dip == -1)
 		return 1;
-	}
 
 	for (i = 0; i < 4; i++) {
 		if ((dip & (1 << i)) == 0)
@@ -299,9 +293,9 @@ int do_vcc5v(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		return 1;
 	}
 
-	if ((vcc5v = read_vcc5v()) == -1) {
-		return (1);
-	}
+	vcc5v = read_vcc5v();
+	if (vcc5v == -1)
+		return 1;
 
 	printf("%d", (vcc5v / 1000));
 	printf(".%d", (vcc5v % 1000) / 100);
@@ -345,30 +339,24 @@ int do_burn_in_status(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	}
 
 	if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_STATUS, 1,
-			      (unsigned char *)&status, 1)) {
-		return (1);
-	}
+			      (unsigned char *)&status, 1))
+		return 1;
 	if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_PASS_CYCLES, 1,
-			      (unsigned char *)&pass_cycles, 2)) {
-		return (1);
-	}
+			      (unsigned char *)&pass_cycles, 2))
+		return 1;
 	if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_CYCLE,
-			      1, (unsigned char *)&first_error_cycle, 2)) {
-		return (1);
-	}
+			      1, (unsigned char *)&first_error_cycle, 2))
+		return 1;
 	if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NUM,
-				1, (unsigned char *) &first_error_num, 1)) {
-		return (1);
-	}
+			      1, (unsigned char *)&first_error_num, 1))
+		return 1;
 	if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME,
 			      1, (unsigned char *)first_error_name,
-			      sizeof(first_error_name))) {
-		return (1);
-	}
+			      sizeof(first_error_name)))
+		return 1;
 
-	if (read_max_cycles() != 0) {
-		return (1);
-	}
+	if (read_max_cycles() != 0)
+		return 1;
 
 	printf("max_cycles = %d\n", max_cycles);
 	printf("status = %d\n", status);
@@ -406,10 +394,11 @@ static int read_dip(void)
 
 	for (i = 7; i > 3; i--) {
 
-		if ((adc_val = adc_read(i)) == -1) {
+		adc_val = adc_read(i);
+		if (adc_val == -1) {
 			printf("%s: Channel %d could not be read\n",
 			       __FUNCTION__, i);
-			return (-1);
+			return -1;
 		}
 
 		/*
@@ -420,7 +409,7 @@ static int read_dip(void)
 		if (adc_val < 368)
 			result |= (1 << (i - 4));
 	}
-	return (result);
+	return result;
 }
 
 static int read_vcc5v(void)
@@ -429,9 +418,10 @@ static int read_vcc5v(void)
 
 	/* VCC5V is connected to channel 2 */
 
-	if ((result = adc_read(2)) == -1) {
+	result = adc_read(2);
+	if (result == -1) {
 		printf("%s: VCC5V could not be read\n", __FUNCTION__);
-		return (-1);
+		return -1;
 	}
 	/*
 	 * Calculate voltage value. Split in two parts because there is no
@@ -440,41 +430,42 @@ static int read_vcc5v(void)
 	 */
 	result = result * 10 * 1000 / 1023; /* result in mV */
 
-	return (result);
+	return result;
 }
 
 static int test_dip(void)
 {
 	static int first_run = 1;
 	static int first_dip;
+	int this_dip;
 
 	if (first_run) {
-		if ((first_dip = read_dip()) == -1) {
-			return (1);
-		}
+		first_dip = read_dip();
+		if (first_dip == -1)
+			return 1;
 		first_run = 0;
 		debug("%s: first_dip=%d\n", __FUNCTION__, first_dip);
 	}
-	if (first_dip != read_dip()) {
-		return (1);
-	} else {
-		return (0);
-	}
+	this_dip = read_dip();
+	if (first_dip != this_dip)
+		return 1;
+	else
+		return 0;
 }
 
 static int test_vcc5v(void)
 {
 	int vcc5v;
 
-	if ((vcc5v = read_vcc5v()) == -1) {
-		return (1);
-	}
+	vcc5v = read_vcc5v();
+	if (vcc5v == -1)
+		return 1;
 
 	if ((vcc5v > VCC5V_MAX) || (vcc5v < VCC5V_MIN)) {
 		printf("%s: vcc5v[V/100]=%d\n", __FUNCTION__, vcc5v);
-		return (1);
+		return 1;
 	} else {
-		return (0);
+		return 0;
 	}
 }
 
@@ -495,16 +486,15 @@ static int test_rotary_switch(void)
 		debug("%s: first_rs=%d\n", __FUNCTION__, first_rs);
 	}
 
-	if (first_rs != ((*CPLD_ROTARY_SWITCH >> 16) & 0x7)) {
-		return (1);
-	} else {
-		return (0);
-	}
+	if (first_rs != ((*CPLD_ROTARY_SWITCH >> 16) & 0x7))
+		return 1;
+	else
+		return 0;
 }
 
 static int test_sram(void)
 {
-	return (memory_post_tests(SRAM_ADDR, SRAM_SIZE));
+	return memory_post_tests(SRAM_ADDR, SRAM_SIZE);
 }
 
 static int test_eeprom(void)
@@ -515,14 +505,12 @@ static int test_eeprom(void)
 	/* write test string 1, read back and verify */
 	if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1,
 			       (unsigned char *)EEPROM_TEST_STRING_1,
-			       sizeof(EEPROM_TEST_STRING_1))) {
-		return (1);
-	}
+			       sizeof(EEPROM_TEST_STRING_1)))
+		return 1;
 
 	if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1,
-			      temp, sizeof(EEPROM_TEST_STRING_1))) {
-		return (1);
-	}
+			      temp, sizeof(EEPROM_TEST_STRING_1)))
+		return 1;
 
 	if (strcmp((char *)temp, EEPROM_TEST_STRING_1) != 0) {
 		result = 1;
@@ -533,14 +521,12 @@ static int test_eeprom(void)
 	if (result == 0) {
 		if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1,
 				       (unsigned char *)EEPROM_TEST_STRING_2,
-				       sizeof(EEPROM_TEST_STRING_2))) {
-			return (1);
-		}
+				       sizeof(EEPROM_TEST_STRING_2)))
+			return 1;
 
 		if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1,
-				      temp, sizeof(EEPROM_TEST_STRING_2))) {
-			return (1);
-		}
+				      temp, sizeof(EEPROM_TEST_STRING_2)))
+			return 1;
 
 		if (strcmp((char *)temp, EEPROM_TEST_STRING_2) != 0) {
 			result = 1;
@@ -548,7 +534,7 @@ static int test_eeprom(void)
 			       __FUNCTION__, temp);
 		}
 	}
-	return (result);
+	return result;
 }
 
 static int test_contact_temp(void)
@@ -559,9 +545,9 @@ static int test_contact_temp(void)
 
 	if ((contact_temp < MIN_CONTACT_TEMP)
 	    || (contact_temp > MAX_CONTACT_TEMP))
-		return (1);
+		return 1;
 	else
-		return (0);
+		return 0;
 }
 
 int i2c_write_multiple(uchar chip, uint addr, int alen,
@@ -572,24 +558,18 @@ int i2c_write_multiple(uchar chip, uint addr, int alen,
 	if (alen != 1) {
 		printf("%s: addr len other than 1 not supported\n",
 		       __FUNCTION__);
-		return (1);
+		return 1;
 	}
 
 	for (i = 0; i < len; i++) {
 		if (i2c_write(chip, addr+i, alen, buffer+i, 1)) {
 			printf("%s: could not write to i2c device %d"
 			       ", addr %d\n", __FUNCTION__, chip, addr);
-			return (1);
+			return 1;
 		}
-#if 0
-		printf("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i="
-		       "%#x+%d=%p=\"%.1s\"\n", chip, addr, i, addr+i,
-		       alen, buffer, i, buffer+i, buffer+i);
-#endif
-
 		udelay(30000);
 	}
-	return (0);
+	return 0;
 }
 
 int i2c_read_multiple(uchar chip, uint addr, int alen,
@@ -600,17 +580,17 @@ int i2c_read_multiple(uchar chip, uint addr, int alen,
 	if (alen != 1) {
 		printf("%s: addr len other than 1 not supported\n",
 		       __FUNCTION__);
-		return (1);
+		return 1;
 	}
 
 	for (i = 0; i < len; i++) {
 		if (i2c_read(chip, addr+i, alen, buffer+i, 1)) {
 			printf("%s: could not read from i2c device %#x"
 			       ", addr %d\n", __FUNCTION__, chip, addr);
-			return (1);
+			return 1;
 		}
 	}
-	return (0);
+	return 0;
 }
 
 static int adc_read(unsigned int channel)
@@ -653,7 +633,7 @@ static int adc_read(unsigned int channel)
 	 */
 	udelay(1000);
 
-	return (result);
+	return result;
 }
 
 static void adc_init(void)
@@ -729,27 +709,22 @@ static void sdelay(unsigned long seconds)
 static int global_vars_write_to_eeprom(void)
 {
 	if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_STATUS, 1,
-			       (unsigned char *) &status, 1)) {
-		return (1);
-	}
+			       (unsigned char *) &status, 1))
+		return 1;
 	if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_PASS_CYCLES, 1,
-			       (unsigned char *) &pass_cycles, 2)) {
-		return (1);
-	}
+			       (unsigned char *) &pass_cycles, 2))
+		return 1;
 	if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_CYCLE,
-			       1, (unsigned char *) &first_error_cycle, 2)) {
-		return (1);
-	}
+			       1, (unsigned char *) &first_error_cycle, 2))
+		return 1;
 	if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NUM,
-			       1, (unsigned char *) &first_error_num, 1)) {
-		return (1);
-	}
+			       1, (unsigned char *) &first_error_num, 1))
+		return 1;
 	if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME,
 			       1, (unsigned char *) first_error_name,
-			       sizeof(first_error_name))) {
-		return (1);
-	}
-	return (0);
+			       sizeof(first_error_name)))
+		return 1;
+	return 0;
 }
 
 static void global_vars_init(void)
@@ -796,16 +771,15 @@ static void test_function_table_init(void)
 static int read_max_cycles(void)
 {
 	if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_MAX_CYCLES, 1,
-			      (unsigned char *) &max_cycles, 2) != 0) {
-		return (1);
-	}
+			      (unsigned char *) &max_cycles, 2) != 0)
+		return 1;
 
-	return (0);
+	return 0;
 }
 
 static int dummy(void)
 {
-	return (0);
+	return 0;
 }
 
 int do_temp_log(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -821,9 +795,8 @@ int do_temp_log(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		return 1;
 	}
 
-	if (argc > 1) {
+	if (argc > 1)
 		delay = simple_strtoul(argv[1], NULL, 10);
-	}
 
 	tsc2000_spi_init();
 	while (1) {
diff --git a/board/trab/rs485.c b/board/trab/rs485.c
index 2dfd202..79f8cc4 100644
--- a/board/trab/rs485.c
+++ b/board/trab/rs485.c
@@ -62,7 +62,8 @@ static void rs485_setbrg(void)
 	uart->UCON = 0x245;
 	uart->UBRDIV = reg;
 
-	for (i = 0; i < 100; i++);
+	for (i = 0; i < 100; i++)
+		;
 }
 
 static void rs485_cfgio(void)
@@ -91,7 +92,7 @@ int rs485_init(void)
 	rs485_cfgio();
 	rs485_setbrg();
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -103,8 +104,8 @@ int rs485_getc(void)
 {
 	struct s3c24x0_uart * const uart = s3c24x0_get_base_uart(UART_NR);
 
-	/* wait for character to arrive */
-	while (!(uart->UTRSTAT & 0x1));
+	while (!(uart->UTRSTAT & 0x1))
+		/* wait for character to arrive */;
 
 	return uart->URXH & 0xff;
 }
@@ -116,8 +117,8 @@ void rs485_putc(const char c)
 {
 	struct s3c24x0_uart * const uart = s3c24x0_get_base_uart(UART_NR);
 
-	/* wait for room in the tx FIFO */
-	while (!(uart->UTRSTAT & 0x2));
+	while (!(uart->UTRSTAT & 0x2))
+		/* wait for room in the tx FIFO */;
 
 	uart->UTXH = c;
 
@@ -138,9 +139,8 @@ int rs485_tstc(void)
 
 void rs485_puts(const char *s)
 {
-	while (*s) {
+	while (*s)
 		rs485_putc(*s++);
-	}
 }
 
 /*
diff --git a/board/trab/trab.c b/board/trab/trab.c
index 0175d77..80016bc 100644
--- a/board/trab/trab.c
+++ b/board/trab/trab.c
@@ -28,6 +28,7 @@
 #include <malloc.h>
 #include <asm/arch/s3c24x0_cpu.h>
 #include <command.h>
+#include "trab.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,8 +41,6 @@ static void tsc2000_set_brightness(void);
 #endif
 #ifdef CONFIG_MODEM_SUPPORT
 static int key_pressed(void);
-extern void disable_putc(void);
-extern int do_mdm_init; /* defined in common/main.c */
 
 /*
  * We need a delay of at least 500 us after turning on the VFD clock
@@ -67,9 +66,6 @@ static void udelay_no_timer(int usec)
 
 int board_init()
 {
-#if defined(CONFIG_VFD)
-	extern int vfd_init_clocks(void);
-#endif
 	struct s3c24x0_clock_power * const clk_power =
 					s3c24x0_get_base_clock_power();
 	struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
@@ -93,12 +89,12 @@ int board_init()
 	gpio->PBUP = 0xffff;
 	/* INPUT nCTS0 nRTS0 TXD[1] TXD[0] RXD[1] RXD[0]        */
 	/*  00,    10,      10,      10,      10,      10,      10      */
-	gpio->PFCON = (2 << 0) | (2 << 2) | (2 << 4) | \
-			(2 << 6) | (2 << 8) | (2 << 10);
+	gpio->PFCON = (2 << 0) | (2 << 2) | (2 << 4) |
+		      (2 << 6) | (2 << 8) | (2 << 10);
 #ifdef CONFIG_HWFLOW
 	/* do not pull up RXD0, RXD1, TXD0, TXD1, CTS0, RTS0 */
-	gpio->PFUP = (1 << 0) | (1 << 1) | (1 << 2) | \
-			(1 << 3) | (1 << 4) | (1 << 5);
+	gpio->PFUP = (1 << 0) | (1 << 1) | (1 << 2) |
+		     (1 << 3) | (1 << 4) | (1 << 5);
 #else
 	/* do not pull up RXD0, RXD1, TXD0, TXD1 */
 	gpio->PFUP = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3);
@@ -173,23 +169,19 @@ int misc_init_r(void)
 		 * version variable has to be set this early, because so it
 		 * could be used in script files on an usb stick, which
 		 * might be called during do_auto_update() */
-		extern char version_string[];
-
-		setenv ("ver", version_string);
+		setenv("ver", (char *)version_string);
 	}
 #endif /* CONFIG_VERSION_VARIABLE */
 
 #ifdef CONFIG_AUTO_UPDATE
 	{
-		extern int do_auto_update(void);
 		/* this has priority over all else */
 		do_auto_update();
 	}
 #endif
 
-	for (i = 0; i < KEYBD_KEY_NUM; ++i) {
+	for (i = 0; i < KEYBD_KEY_NUM; ++i)
 		keybd_env[i] = '0' + ((kbd_data >> i) & 1);
-	}
 	keybd_env[i] = '\0';
 	debug("** Setting keybd=\"%s\"\n", keybd_env);
 	setenv("keybd", keybd_env);
@@ -201,14 +193,12 @@ int misc_init_r(void)
 	debug("** Setting preboot=\"%s\"\n", str);
 	setenv("preboot", str);	/* set or delete definition */
 #endif /* CONFIG_PREBOOT */
-	if (str != NULL) {
+	if (str != NULL)
 		free(str);
-	}
-
 #ifdef CONFIG_SYS_BRIGHTNESS
 	tsc2000_set_brightness();
 #endif
-	return (0);
+	return 0;
 }
 
 #ifdef CONFIG_PREBOOT
@@ -297,11 +287,11 @@ static char *key_match(ulong kbd_data)
 			      cmd_name,
 			      getenv(cmd_name) ?
 			      getenv(cmd_name) : "<UNDEFINED>");
-			return (getenv(cmd_name));
+			return getenv(cmd_name);
 		}
 	}
 	debug("key_match: no match\n");
-	return (NULL);
+	return NULL;
 }
 #endif	/* CONFIG_PREBOOT */
 
@@ -328,7 +318,7 @@ U_BOOT_CMD(kbd, 1, 1, do_kbd, "read keyboard status", "");
 #ifdef CONFIG_MODEM_SUPPORT
 static int key_pressed(void)
 {
-	return (compare_magic(KBD_DATA, CONFIG_MODEM_KEY_MAGIC) == 0);
+	return compare_magic(KBD_DATA, CONFIG_MODEM_KEY_MAGIC) == 0;
 }
 #endif	/* CONFIG_MODEM_SUPPORT */
 
@@ -370,9 +360,8 @@ static void spi_init(void)
 	spi->ch[0].SPCON = 0x1A;
 
 	/* Dummy byte ensures clock to be low. */
-	for (i = 0; i < 10; i++) {
+	for (i = 0; i < 10; i++)
 		spi->ch[0].SPTDAT = 0xFF;
-	}
 	wait_transmit_done();
 }
 
@@ -380,8 +369,8 @@ static void wait_transmit_done(void)
 {
 	struct s3c24x0_spi * const spi = s3c24x0_get_base_spi();
 
-	/* wait until transfer is done */
-	while (!(spi->ch[0].SPSTA & 0x01));
+	while (!(spi->ch[0].SPSTA & 0x01))
+		/* wait until transfer is done */;
 }
 
 static void tsc2000_write(unsigned int page, unsigned int reg,
@@ -417,7 +406,7 @@ static void tsc2000_set_brightness(void)
 
 	i = getenv_r("brightness", tmp, sizeof(tmp));
 	br = (i > 0) ? (int)simple_strtoul(tmp, NULL, 10) :
-			CONFIG_SYS_BRIGHTNESS;
+	     CONFIG_SYS_BRIGHTNESS;
 
 	tsc2000_write(0, 0xb, br & 0xff);
 }
diff --git a/board/trab/trab.h b/board/trab/trab.h
new file mode 100644
index 0000000..9eb2702
--- /dev/null
+++ b/board/trab/trab.h
@@ -0,0 +1,38 @@
+/*
+ * Functions to access the TSC2000 controller on TRAB board (used for scanning
+ * thermo sensors)
+ *
+ * Copyright (C) 2009 Kevin Morfitt, kevin.morfitt at fearnside-systems.co.uk
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#if defined(CONFIG_VFD)
+int vfd_init_clocks(void);
+#endif
+#ifdef CONFIG_AUTO_UPDATE
+int do_auto_update(void);
+#endif
+#if defined(CONFIG_CMD_I2C)
+int i2c_write_multiple(uchar chip, uint addr, int alen,
+			uchar *buffer, int len);
+int i2c_read_multiple(uchar chip, uint addr, int alen,
+		       uchar *buffer, int len);
+#endif
+
diff --git a/board/trab/trab_fkt.c b/board/trab/trab_fkt.c
index b9a2bb9..da0c3b1 100644
--- a/board/trab/trab_fkt.c
+++ b/board/trab/trab_fkt.c
@@ -105,31 +105,31 @@
 #define ADC_ECFLG		0x8000
 
 /* function test functions */
-int do_dip(void);
-int do_info(void);
-int do_vcc5v(void);
-int do_vcc12v(void);
-int do_buttons(void);
-int do_fill_level(void);
-int do_rotary_switch(void);
-int do_pressure(void);
-int do_v_bat(void);
-int do_vfd_id(void);
-int do_buzzer(char **);
-int do_led(char **);
-int do_full_bridge(char **);
-int do_dac(char **);
-int do_motor_contact(void);
-int do_motor(char **);
-int do_pwm(char **);
-int do_thermo(char **);
-int do_touch(char **);
-int do_rs485(char **);
-int do_serial_number(char **);
-int do_crc16(void);
-int do_power_switch(void);
-int do_gain(char **);
-int do_eeprom(char **);
+static int do_dip(void);
+static int do_info(void);
+static int do_vcc5v(void);
+static int do_vcc12v(void);
+static int do_buttons(void);
+static int do_fill_level(void);
+static int do_rotary_switch(void);
+static int do_pressure(void);
+static int do_v_bat(void);
+static int do_vfd_id(void);
+static int do_buzzer(char **);
+static int do_led(char **);
+static int do_full_bridge(char **);
+static int do_dac(char **);
+static int do_motor_contact(void);
+static int do_motor(char **);
+static int do_pwm(char **);
+static int do_thermo(char **);
+static int do_touch(char **);
+static int do_rs485(char **);
+static int do_serial_number(char **);
+static int do_crc16(void);
+static int do_power_switch(void);
+static int do_gain(char **);
+static int do_eeprom(char **);
 
 /* helper functions */
 static void adc_init(void);
@@ -152,10 +152,10 @@ static unsigned short updcrc(unsigned short icrc, unsigned char *icp,
 #if defined(CONFIG_CMD_I2C)
 static int trab_eeprom_read(char **argv);
 static int trab_eeprom_write(char **argv);
-int i2c_write_multiple(uchar chip, uint addr, int alen, uchar *buffer,
-		       int len);
-int i2c_read_multiple(uchar chip, uint addr, int alen, uchar *buffer,
-		      int len);
+static int i2c_write_multiple(uchar chip, uint addr, int alen, uchar *buffer,
+			      int len);
+static int i2c_read_multiple(uchar chip, uint addr, int alen, uchar *buffer,
+			     int len);
 #endif
 
 /*
@@ -189,95 +189,68 @@ int trab_fkt(int argc, char *argv[])
 	case 1:
 		break;
 	case 2:
-		if (strcmp(argv[1], "info") == 0) {
-			return (do_info());
-		}
-		if (strcmp(argv[1], "dip") == 0) {
-			return (do_dip());
-		}
-		if (strcmp(argv[1], "vcc5v") == 0) {
-			return (do_vcc5v());
-		}
-		if (strcmp(argv[1], "vcc12v") == 0) {
-			return (do_vcc12v());
-		}
-		if (strcmp(argv[1], "buttons") == 0) {
-			return (do_buttons());
-		}
-		if (strcmp(argv[1], "fill_level") == 0) {
-			return (do_fill_level());
-		}
-		if (strcmp(argv[1], "rotary_switch") == 0) {
-			return (do_rotary_switch());
-		}
-		if (strcmp(argv[1], "pressure") == 0) {
-			return (do_pressure());
-		}
-		if (strcmp(argv[1], "v_bat") == 0) {
-			return (do_v_bat());
-		}
-		if (strcmp(argv[1], "vfd_id") == 0) {
-			return (do_vfd_id());
-		}
-		if (strcmp(argv[1], "motor_contact") == 0) {
-			return (do_motor_contact());
-		}
-		if (strcmp(argv[1], "crc16") == 0) {
-			return (do_crc16());
-		}
-		if (strcmp(argv[1], "power_switch") == 0) {
-			return (do_power_switch());
-		}
+		if (strcmp(argv[1], "info") == 0)
+			return do_info();
+		if (strcmp(argv[1], "dip") == 0)
+			return do_dip();
+		if (strcmp(argv[1], "vcc5v") == 0)
+			return do_vcc5v();
+		if (strcmp(argv[1], "vcc12v") == 0)
+			return do_vcc12v();
+		if (strcmp(argv[1], "buttons") == 0)
+			return do_buttons();
+		if (strcmp(argv[1], "fill_level") == 0)
+			return do_fill_level();
+		if (strcmp(argv[1], "rotary_switch") == 0)
+			return do_rotary_switch();
+		if (strcmp(argv[1], "pressure") == 0)
+			return do_pressure();
+		if (strcmp(argv[1], "v_bat") == 0)
+			return do_v_bat();
+		if (strcmp(argv[1], "vfd_id") == 0)
+			return do_vfd_id();
+		if (strcmp(argv[1], "motor_contact") == 0)
+			return do_motor_contact();
+		if (strcmp(argv[1], "crc16") == 0)
+			return do_crc16();
+		if (strcmp(argv[1], "power_switch") == 0)
+			return do_power_switch();
 		break;
 	case 3:
-		if (strcmp(argv[1], "full_bridge") == 0) {
-			return (do_full_bridge(argv));
-		}
-		if (strcmp(argv[1], "dac") == 0) {
-			return (do_dac(argv));
-		}
-		if (strcmp(argv[1], "motor") == 0) {
-			return (do_motor(argv));
-		}
-		if (strcmp(argv[1], "pwm") == 0) {
-			return (do_pwm(argv));
-		}
-		if (strcmp(argv[1], "thermo") == 0) {
-			return (do_thermo(argv));
-		}
-		if (strcmp(argv[1], "touch") == 0) {
-			return (do_touch(argv));
-		}
-		if (strcmp(argv[1], "serial_number") == 0) {
-			return (do_serial_number(argv));
-		}
-		if (strcmp(argv[1], "buzzer") == 0) {
-			return (do_buzzer(argv));
-		}
-		if (strcmp(argv[1], "gain") == 0) {
-			return (do_gain(argv));
-		}
+		if (strcmp(argv[1], "full_bridge") == 0)
+			return do_full_bridge(argv);
+		if (strcmp(argv[1], "dac") == 0)
+			return do_dac(argv);
+		if (strcmp(argv[1], "motor") == 0)
+			return do_motor(argv);
+		if (strcmp(argv[1], "pwm") == 0)
+			return do_pwm(argv);
+		if (strcmp(argv[1], "thermo") == 0)
+			return do_thermo(argv);
+		if (strcmp(argv[1], "touch") == 0)
+			return do_touch(argv);
+		if (strcmp(argv[1], "serial_number") == 0)
+			return do_serial_number(argv);
+		if (strcmp(argv[1], "buzzer") == 0)
+			return do_buzzer(argv);
+		if (strcmp(argv[1], "gain") == 0)
+			return do_gain(argv);
 		break;
 	case 4:
-		if (strcmp(argv[1], "led") == 0) {
-			return (do_led(argv));
-		}
-		if (strcmp(argv[1], "rs485") == 0) {
-			return (do_rs485(argv));
-		}
-		if (strcmp(argv[1], "serial_number") == 0) {
-			return (do_serial_number(argv));
-		}
+		if (strcmp(argv[1], "led") == 0)
+			return do_led(argv);
+		if (strcmp(argv[1], "rs485") == 0)
+			return do_rs485(argv);
+		if (strcmp(argv[1], "serial_number") == 0)
+			return do_serial_number(argv);
 		break;
 	case 5:
-		if (strcmp(argv[1], "eeprom") == 0) {
-			return (do_eeprom(argv));
-		}
+		if (strcmp(argv[1], "eeprom") == 0)
+			return do_eeprom(argv);
 		break;
 	case 6:
-		if (strcmp(argv[1], "eeprom") == 0) {
-			return (do_eeprom(argv));
-		}
+		if (strcmp(argv[1], "eeprom") == 0)
+			return do_eeprom(argv);
 		break;
 	default:
 		break;
@@ -290,7 +263,8 @@ int trab_fkt(int argc, char *argv[])
 void hang(void)
 {
 	puts("### ERROR ### Please RESET the board ###\n");
-	for (;;);
+	for (;;)
+		/* Do nothing */;
 }
 
 int do_info(void)
@@ -431,7 +405,7 @@ static int adc_read(unsigned int channel)
 	 */
 	udelay(1000);
 
-	return (result);
+	return result;
 }
 
 static void adc_init(void)
@@ -607,7 +581,7 @@ int do_buzzer(char **argv)
 		timers->TCON = (timers->TCON | UPDATE2 | RELOAD2) &
 				~INVERT2;
 		timers->TCON = (timers->TCON | START2) & ~UPDATE2;
-		return (0);
+		return 0;
 	}
 	else if (strcmp(argv[2], "off") == 0) {
 		/* stop */
@@ -617,7 +591,7 @@ int do_buzzer(char **argv)
 		gpio->PDCON &= ~0xC000;
 		gpio->PDCON |= 0x4000;
 		gpio->PDDAT &= ~0x80;
-		return (0);
+		return 0;
 	}
 
 	printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
@@ -878,9 +852,8 @@ int do_touch(char **argv)
 		{
 			int i;
 			for (i = 0; i < (TOUCH_TIMEOUT * 1000); i++) {
-				if (touch_check_pressed()) {
+				if (touch_check_pressed())
 					break;
-				}
 				udelay(1000);	/* pause 1 ms */
 			}
 		}
@@ -903,9 +876,8 @@ int do_touch(char **argv)
 		{
 			int i;
 			for (i = 0; i < (TOUCH_TIMEOUT * 1000); i++) {
-				if (touch_check_pressed()) {
+				if (touch_check_pressed())
 					break;
-				}
 				udelay(1000);	/* pause 1 ms */
 			}
 		}
@@ -928,13 +900,14 @@ int do_touch(char **argv)
 #ifdef CONFIG_TOUCH_WAIT_PRESSED
 static void touch_wait_pressed(void)
 {
-	while (!(tsc2000_read(TSC2000_REG_ADC) & TC_PSM));
+	while (!(tsc2000_read(TSC2000_REG_ADC) & TC_PSM))
+		/* Wait */;
 }
 
 #else
 static int touch_check_pressed(void)
 {
-	return (tsc2000_read(TSC2000_REG_ADC) & TC_PSM);
+	return tsc2000_read(TSC2000_REG_ADC) & TC_PSM;
 }
 #endif /* CONFIG_TOUCH_WAIT_PRESSED */
 
@@ -948,23 +921,19 @@ static int touch_write_clibration_values(int calib_point, int x, int y)
 
 	if (calib_point == CALIB_TL) {
 		if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
-				       (unsigned char *)&x, 2)) {
+				       (unsigned char *)&x, 2))
 			return 1;
-		}
 		if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
-			 	       (unsigned char *)&y, 2)) {
+				       (unsigned char *)&y, 2))
 			return 1;
-		}
 
 		/* verify written values */
 		if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
-				      (unsigned char *)&x_verify, 2)) {
+				      (unsigned char *)&x_verify, 2))
 			return 1;
-		}
 		if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
-				      (unsigned char *)&y_verify, 2)) {
+				      (unsigned char *)&y_verify, 2))
 			return 1;
-		}
 		if ((y != y_verify) || (x != x_verify)) {
 			print_identifier();
 			printf("error: verify error\n");
@@ -974,23 +943,19 @@ static int touch_write_clibration_values(int calib_point, int x, int y)
 	}
 	else if (calib_point == CALIB_DR) {
 		if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
-			 	       (unsigned char *)&x, 2)) {
+				       (unsigned char *)&x, 2))
 			return 1;
-		}
 		if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
-				       (unsigned char *)&y, 2)) {
+				       (unsigned char *)&y, 2))
 			return 1;
-		}
 
 		/* verify written values */
 		if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
-				      (unsigned char *)&x_verify, 2)) {
+				      (unsigned char *)&x_verify, 2))
 			return 1;
-		}
 		if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
-				      (unsigned char *)&y_verify, 2)) {
+				      (unsigned char *)&y_verify, 2))
 			return 1;
-		}
 		if ((y != y_verify) || (x != x_verify)) {
 			print_identifier();
 			printf("error: verify error\n");
@@ -1002,7 +967,7 @@ static int touch_write_clibration_values(int calib_point, int x, int y)
 #else
 	printf("No I2C support enabled (CONFIG_CMD_I2C), could not write "
 	       "to EEPROM\n");
-	return (1);
+	return 1;
 #endif
 }
 
@@ -1022,24 +987,23 @@ int do_rs485(char **argv)
 	int timeout;
 	char data[RS485_MAX_RECEIVE_BUF_LEN];
 
-	if (strcmp(argv[2], "send") == 0) {
-		return (rs485_send_line(argv[3]));
-	}
+	if (strcmp(argv[2], "send") == 0)
+		return rs485_send_line(argv[3]);
 	else if (strcmp(argv[2], "receive") == 0) {
 		timeout = simple_strtoul(argv[3], NULL, 10);
 		if (rs485_receive_chars(data, timeout) != 0) {
 			print_identifier();
 			printf("## nothing received\n");
-			return (1);
+			return 1;
 		}
 		else {
 			print_identifier();
 			printf("%s\n", data);
-			return (0);
+			return 0;
 		}
 	}
 	printf("%s: unknown command %s\n", __FUNCTION__, argv[2]);
-	return (1);	/* unknown command, return error */
+	return 1;	/* unknown command, return error */
 }
 
 static int rs485_send_line(const char *data)
@@ -1049,7 +1013,7 @@ static int rs485_send_line(const char *data)
 	rs485_puts(data);
 	rs485_putc('\n');
 
-	return (0);
+	return 0;
 }
 
 static int rs485_receive_chars(char *data, int timeout)
@@ -1074,9 +1038,9 @@ static int rs485_receive_chars(char *data, int timeout)
 	*data = '\0';	/* terminate string */
 
 	if (receive_count == 0)
-		return (1);
+		return 1;
 	else
-		return (0);
+		return 0;
 }
 
 int do_serial_number(char **argv)
@@ -1088,31 +1052,30 @@ int do_serial_number(char **argv)
 		if (i2c_read(I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
 			     (unsigned char *)&serial_number, 4)) {
 			printf("could not read from eeprom\n");
-			return (1);
+			return 1;
 		}
 		print_identifier();
 		printf("%08d\n", serial_number);
-		return (0);
+		return 0;
 	}
 	else if (strcmp(argv[2], "write") == 0) {
 		serial_number = simple_strtoul(argv[3], NULL, 10);
 		if (i2c_write(I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
 			      (unsigned char *)&serial_number, 4)) {
 			printf("could not write to eeprom\n");
-			return (1);
+			return 1;
 		}
-		return (0);
+		return 0;
 	}
 	printf("%s: unknown command %s\n", __FUNCTION__, argv[2]);
-	return (1);	/* unknown command, return error */
+	return 1;	/* unknown command, return error */
 #else
 	printf("No I2C support enabled (CONFIG_CMD_I2C), could not write "
 	       "to EEPROM\n");
-	return (1);
+	return 1;
 #endif
 }
 
-
 int do_crc16(void)
 {
 #if defined(CONFIG_CMD_I2C)
@@ -1121,7 +1084,7 @@ int do_crc16(void)
 
 	if (i2c_read(I2C_EEPROM_DEV_ADDR, 0, 1, buf, 60)) {
 		printf("could not read from eeprom\n");
-		return (1);
+		return 1;
 	}
 	crc = 0;	/* start value of crc calculation */
 	crc = updcrc(crc, buf, 60);
@@ -1132,13 +1095,13 @@ int do_crc16(void)
 	if (i2c_write(I2C_EEPROM_DEV_ADDR, CRC16, 1, (unsigned char *)&crc,
 		      sizeof(crc))) {
 		printf("could not read from eeprom\n");
-		return (1);
+		return 1;
 	}
-	return (0);
+	return 0;
 #else
 	printf("No I2C support enabled (CONFIG_CMD_I2C), could not write "
 	       "to EEPROM\n");
-	return (1);
+	return 1;
 #endif
 }
 
@@ -1213,7 +1176,7 @@ static unsigned short updcrc(unsigned short icrc, unsigned char *icp,
 	while (cnt--)
 		crc = (crc<<B) ^ crctab[(crc>>(W-B)) ^ *cp++];
 
-	return (crc);
+	return crc;
 }
 
 int do_gain(char **argv)
@@ -1228,26 +1191,23 @@ int do_gain(char **argv)
 	}
 
 	tsc2000_set_range(range);
-	return (0);
+	return 0;
 }
 
 int do_eeprom(char **argv)
 {
 #if defined(CONFIG_CMD_I2C)
-	if (strcmp(argv[2], "read") == 0) {
-		return (trab_eeprom_read(argv));
-	}
-
-	else if (strcmp(argv[2], "write") == 0) {
-		return (trab_eeprom_write(argv));
-	}
+	if (strcmp(argv[2], "read") == 0)
+		return trab_eeprom_read(argv);
+	else if (strcmp(argv[2], "write") == 0)
+		return trab_eeprom_write(argv);
 
 	printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
-	return (1);
+	return 1;
 #else
 	printf("No I2C support enabled (CONFIG_CMD_I2C), could not write "
 	       "to EEPROM\n");
-	return (1);
+	return 1;
 #endif
 }
 
@@ -1266,14 +1226,14 @@ static int trab_eeprom_read(char **argv)
 	len = simple_strtoul(argv[4], NULL, 10);
 	if ((len < 1) || (len > 4)) {
 		printf("%s: invalid parameter %s\n", __FUNCTION__, argv[4]);
-		return (1);
+		return 1;
 	}
 	for (i = 0; i < len; i++) {
 		if (i2c_read(I2C_EEPROM_DEV_ADDR, addr+i, 1, buffer+i, 1)) {
 			printf("%s: could not read from i2c device %#x"
 			       ", addr %d\n", __FUNCTION__,
 			       I2C_EEPROM_DEV_ADDR, addr);
-			return (1);
+			return 1;
 		}
 	}
 	print_identifier();
@@ -1293,7 +1253,7 @@ static int trab_eeprom_read(char **argv)
 		else
 			printf("%ld\n", (unsigned long int)value);
 	}
-	return (0);
+	return 0;
 }
 
 static int trab_eeprom_write(char **argv)
@@ -1310,7 +1270,7 @@ static int trab_eeprom_write(char **argv)
 	len = simple_strtoul(argv[4], NULL, 10);
 	if ((len < 1) || (len > 4)) {
 		printf("%s: invalid parameter %s\n", __FUNCTION__, argv[4]);
-		return (1);
+		return 1;
 	}
 	value = simple_strtol(argv[5], NULL, 10);
 	debug("value=%ld\n", value);
@@ -1319,16 +1279,11 @@ static int trab_eeprom_write(char **argv)
 			printf("%s: could not write to i2c device %d"
 			       ", addr %d\n", __FUNCTION__,
 			       I2C_EEPROM_DEV_ADDR, addr);
-			return (1);
+			return 1;
 		}
-#if 0
-		printf("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i="
-		       "%#x+%d=%p=%#x \n", I2C_EEPROM_DEV_ADDR_DEV_ADDR , addr,
-		       i, addr+i, 1, buffer, i, buffer+i, *(buffer+i));
-#endif
 		udelay(30000);	/* wait for EEPROM ready */
 	}
-	return (0);
+	return 0;
 }
 
 int i2c_write_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len)
@@ -1338,24 +1293,18 @@ int i2c_write_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len)
 	if (alen != 1) {
 		printf("%s: addr len other than 1 not supported\n",
 		       __FUNCTION__);
-		return (1);
+		return 1;
 	}
 
 	for (i = 0; i < len; i++) {
 		if (i2c_write(chip, addr+i, alen, buffer+i, 1)) {
 			printf("%s: could not write to i2c device %d"
 			       ", addr %d\n", __FUNCTION__, chip, addr);
-			return (1);
+			return 1;
 		}
-#if 0
-		printf("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i="
-		       "%#x+%d=%p=\"%.1s\"\n", chip, addr, i, addr+i,
-		       alen, buffer, i, buffer+i, buffer+i);
-#endif
-
 		udelay(30000);
 	}
-	return (0);
+	return 0;
 }
 
 int i2c_read_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len)
@@ -1365,16 +1314,16 @@ int i2c_read_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len)
 	if (alen != 1) {
 		printf("%s: addr len other than 1 not supported\n",
 		       __FUNCTION__);
-		return (1);
+		return 1;
 	}
 
 	for (i = 0; i < len; i++) {
 		if (i2c_read(chip, addr+i, alen, buffer+i, 1)) {
 			printf("%s: could not read from i2c device %#x"
 			       ", addr %d\n", __FUNCTION__, chip, addr);
-			return (1);
+			return 1;
 		}
 	}
-	return (0);
+	return 0;
 }
 #endif
diff --git a/board/trab/tsc2000.c b/board/trab/tsc2000.c
index 27d90b2..2855825 100644
--- a/board/trab/tsc2000.c
+++ b/board/trab/tsc2000.c
@@ -65,9 +65,8 @@ void tsc2000_spi_init(void)
 	spi->ch[0].SPCON = 0x1A;
 
 	/* Dummy byte ensures clock to be low. */
-	for (i = 0; i < 10; i++) {
+	for (i = 0; i < 10; i++)
 		spi->ch[0].SPTDAT = 0xFF;
-	}
 	spi_wait_transmit_done();
 }
 
@@ -75,8 +74,8 @@ void spi_wait_transmit_done(void)
 {
 	struct s3c24x0_spi * const spi = s3c24x0_get_base_spi();
 
-	/* wait until transfer is done */
-	while (!(spi->ch[0].SPSTA & 0x01));
+	while (!(spi->ch[0].SPSTA & 0x01))
+		/* wait until transfer is done */;
 }
 
 void tsc2000_write(unsigned short reg, unsigned short data)
@@ -317,7 +316,7 @@ s32 tsc2000_contact_temp(void)
 	if (tsc2000_interpolate(u_pt1000, Pt1000_temp_table,
 				&contact_temp) == -1) {
 		printf("%s: error interpolating PT1000 vlaue\n", __FUNCTION__);
-		return (-1000);
+		return -1000;
 	}
 	debug("contact_temp: %ld\n", contact_temp);
 
@@ -378,5 +377,6 @@ int tsc2000_interpolate(long value, long data[][2], long *result)
 
 void adc_wait_conversion_done(void)
 {
-	while (!(tsc2000_read(TSC2000_REG_ADC) & (1 << 14)));
+	while (!(tsc2000_read(TSC2000_REG_ADC) & (1 << 14)))
+		/* Wait */;
 }
diff --git a/board/trab/tsc2000.h b/board/trab/tsc2000.h
index c7ec0bd..db4b408 100644
--- a/board/trab/tsc2000.h
+++ b/board/trab/tsc2000.h
@@ -124,6 +124,7 @@ void spi_wait_transmit_done(void);
 void tsc2000_spi_init(void);
 int tsc2000_interpolate(long value, long data[][2], long *result);
 void adc_wait_conversion_done(void);
+int memory_post_tests(unsigned long start, unsigned long size);
 
 static inline void SET_CS_TOUCH(void)
 {
diff --git a/board/trab/vfd.c b/board/trab/vfd.c
index 550d1e8..cc7f9d3 100644
--- a/board/trab/vfd.c
+++ b/board/trab/vfd.c
@@ -102,8 +102,8 @@ void init_grid_ctrl(void)
 		for (display = 0; display < 4; display++) {
 			for (grid_cycle = 0; grid_cycle < 56; grid_cycle++) {
 				bit = grid_cycle * 256 * 4 +
-				     (grid_cycle + 200) * 4 +
-				     frame_buf_offs + display;
+				      (grid_cycle + 200) * 4 +
+				      frame_buf_offs + display;
 				/* wrap around if offset (see manual S3C2400) */
 				if (bit >= FRAME_BUF_SIZE * 8)
 					bit = bit - (FRAME_BUF_SIZE * 8);
@@ -122,7 +122,7 @@ void init_grid_ctrl(void)
 				else
 					/* grid nr. 0 */
 					bit = grid_cycle * 256 * 4 + 200 * 4 +
-						frame_buf_offs + display - 4;
+					      frame_buf_offs + display - 4;
 				/* wrap around if offset (see manual S3C2400) */
 				if (bit >= FRAME_BUF_SIZE * 8)
 					bit = bit - (FRAME_BUF_SIZE * 8);
@@ -156,8 +156,8 @@ void init_grid_ctrl(void)
 
 				if (grid_cycle < 37)
 					bit = grid_cycle * 256 * 4 +
-					      (252 - grid_cycle) *
-					      4 + frame_buf_offs + display;
+					      (252 - grid_cycle) * 4 +
+					      frame_buf_offs + display;
 
 				/* wrap around if offset (see manual S3C2400) */
 				if (bit >= FRAME_BUF_SIZE * 8)
@@ -196,13 +196,12 @@ void create_vfd_table(void)
 				for (display = 0; display <= 3; display++) {
 					/* Display 0 blue pixels */
 					vfd_table[x][y][0][display][0] =
-					    (x == 0) ?
-						y * 16 + display :
+						(x == 0) ? y * 16 + display :
 						(x % 4) * 4 + y * 16 +
 						((x - 1) / 2) * 1024 + display;
 					/* Display 0 red pixels */
 					vfd_table[x][y][1][display][0] =
-					    (x == 0) ?
+						(x == 0) ?
 						y * 16 + 512 + display :
 						(x % 4) * 4 + y * 16 +
 						((x - 1) / 2) * 1024 + 512 +
@@ -243,7 +242,7 @@ void create_vfd_table(void)
 
 					/* blue pixels */
 					vfd_table[x][y][0][display][0] =
-					    (x > 1) ?
+						(x > 1) ?
 						x_abcdef * 4 + ((x - 1) / 3) *
 						1024 + y * 48 + display :
 						x_abcdef * 4 + 0 + y * 48 +
@@ -251,13 +250,13 @@ void create_vfd_table(void)
 					/* blue pixels */
 					if (x > 1 && (x - 1) % 3)
 						vfd_table[x][y][0][display][1] =
-						    x_abcdef * 4 +
-						    ((x - 1) / 3 + 1) * 1024 +
-						    y * 48 + display;
+							x_abcdef * 4 +
+							((x - 1) / 3 + 1) * 1024
+							+ y * 48 + display;
 
 					/* red pixels */
 					vfd_table[x][y][1][display][0] =
-					    (x > 1) ?
+						(x > 1) ?
 						x_abcdef * 4 + 24 +
 						((x - 1) / 3) * 1024 + y * 48 +
 						display :
@@ -266,9 +265,9 @@ void create_vfd_table(void)
 					/* red pixels */
 					if (x > 1 && (x - 1) % 3)
 						vfd_table[x][y][1][display][1] =
-						    x_abcdef * 4 + 24 +
-						    ((x - 1) / 3 + 1) * 1024 +
-						    y * 48 + display;
+							x_abcdef * 4 + 24 +
+							((x - 1) / 3 + 1) * 1024
+							+ y * 48 + display;
 				}
 			}
 		}
@@ -300,7 +299,8 @@ void create_vfd_table(void)
 						 */
 						if (pixel >= FRAME_BUF_SIZE * 8)
 							pixel = pixel -
-							(FRAME_BUF_SIZE * 8);
+								(FRAME_BUF_SIZE
+								 * 8);
 						adr = gd->fb_base +
 						      (pixel / 32) * 4 +
 						      (3 - (pixel % 32) / 8);
@@ -310,9 +310,10 @@ void create_vfd_table(void)
 							 bit_nr + 4;
 
 						adr_vfd_table[x][y][color]
-						    [display][entry] = adr;
+							[display][entry] = adr;
 						bit_vfd_table[x][y][color]
-						    [display][entry] = bit_nr;
+							[display][entry] =
+								bit_nr;
 					}
 				}
 			}
@@ -330,10 +331,9 @@ void set_vfd_pixel(unsigned char x, unsigned char y,
 	ulong adr;
 	unsigned char bit_nr, temp;
 
-	if (!gd->vfd_type) {
+	if (!gd->vfd_type)
 		/* Unknown type. */
 		return;
-	}
 
 	/* Pixel-Eintrag Nr. 1 */
 	adr = adr_vfd_table[x][y][color][display][0];
@@ -490,24 +490,23 @@ int drv_vfd_init(void)
 	int vfd_inv_data = 0;
 
 	if (vfd_init_done != 0)
-		return (0);
+		return 0;
 	vfd_init_done = 1;
 
 	debug("Detecting Revison of WA4-VFD: ID=0x%X\n", vfd_board_id);
 
 	switch (vfd_board_id) {
 	case 0:		/* board revision < Rev.200 */
-		if ((tmp = getenv("vfd_type")) == NULL) {
+		tmp = getenv("vfd_type");
+		if (tmp == NULL)
 			break;
-		}
-		if (strcmp(tmp, "T119C") == 0) {
+		if (strcmp(tmp, "T119C") == 0)
 			gd->vfd_type = VFD_TYPE_T119C;
-		} else if (strcmp(tmp, "MN11236") == 0) {
+		else if (strcmp(tmp, "MN11236") == 0)
 			gd->vfd_type = VFD_TYPE_MN11236;
-		} else {
+		else
 			/* cannot use printf for a warning here */
 			gd->vfd_type = 0;	/* unknown */
-		}
 
 		break;
 	default:		/* default to MN11236, data inverted */
@@ -562,12 +561,15 @@ int drv_vfd_init(void)
 	/* Synchronize VFD enable with LCD controller to avoid flicker  */
 	/* Start LCD-Controller */
 	lcd->LCDCON1 = 0x00000B75;
-	/* Wait for end of VSYNC */
-	while ((lcd->LCDCON5 & 0x180000) != 0x100000);
+	while ((lcd->LCDCON5 & 0x180000) != 0x100000)
+		/* Wait for end of VSYNC */;
 	/* Wait for next HSYNC  */
-	while ((lcd->LCDCON5 & 0x060000) != 0x040000);
-	while ((lcd->LCDCON5 & 0x060000) == 0x040000);
-	while ((lcd->LCDCON5 & 0x060000) != 0x000000);
+	while ((lcd->LCDCON5 & 0x060000) != 0x040000)
+		;
+	while ((lcd->LCDCON5 & 0x060000) == 0x040000)
+		;
+	while ((lcd->LCDCON5 & 0x060000) != 0x000000)
+		;
 	if (gd->vfd_type)
 		VFD_ENABLE;
 
@@ -611,7 +613,7 @@ ulong vfd_setmem(ulong addr)
 	debug("Reserving %ldk for VFD Framebuffer at: %08lx\n",
 	      size >> 10, addr);
 
-	return (size);
+	return size;
 }
 
 /*
diff --git a/common/cmd_version.c b/common/cmd_version.c
index 7f165c7..3fd1d0c 100644
--- a/common/cmd_version.c
+++ b/common/cmd_version.c
@@ -24,8 +24,6 @@
 #include <common.h>
 #include <command.h>
 
-extern char version_string[];
-
 int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	printf("\n%s\n", version_string);
diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c
index 9c5b038..e65e212 100644
--- a/common/cmd_vfd.c
+++ b/common/cmd_vfd.c
@@ -41,8 +41,6 @@
 #define VFD_TEST_LOGO_BMPNR 0
 #define VFD_REMOTE_LOGO_BMPNR 1
 
-extern int transfer_pic(unsigned char, unsigned char *, int, int);
-
 int trab_vfd (ulong bitmap);
 
 int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
diff --git a/common/main.c b/common/main.c
index 10d8904..22bc020 100644
--- a/common/main.c
+++ b/common/main.c
@@ -332,9 +332,8 @@ void main_loop (void)
 
 #ifdef CONFIG_VERSION_VARIABLE
 	{
-		extern char version_string[];
-
-		setenv ("ver", version_string);  /* set version variable */
+		/* set version variable */
+		setenv("ver", (char *)version_string);
 	}
 #endif /* CONFIG_VERSION_VARIABLE */
 
diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
index c8371cf..e6c0083 100644
--- a/drivers/i2c/s3c24x0_i2c.c
+++ b/drivers/i2c/s3c24x0_i2c.c
@@ -53,7 +53,7 @@
 
 #define I2C_TIMEOUT 1		/* 1 second */
 
-static int GetI2CSDA(void)
+static int get_i2c_sda(void)
 {
 	struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
 
@@ -65,14 +65,7 @@ static int GetI2CSDA(void)
 #endif
 }
 
-#if 0
-static void SetI2CSDA(int x)
-{
-	rGPEDAT = (rGPEDAT & ~0x8000) | (x & 1) << 15;
-}
-#endif
-
-static void SetI2CSCL(int x)
+static void set_i2c_scl(int x)
 {
 	struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
 
@@ -84,7 +77,7 @@ static void SetI2CSCL(int x)
 #endif
 }
 
-static int WaitForXfer(void)
+static int wait_for_xfer(void)
 {
 	struct s3c24x0_i2c *i2c = s3c24x0_get_base_i2c();
 	int i;
@@ -98,14 +91,14 @@ static int WaitForXfer(void)
 	return (readl(&i2c->IICCON) & I2CCON_IRPND) ? I2C_OK : I2C_NOK_TOUT;
 }
 
-static int IsACK(void)
+static int is_ack(void)
 {
 	struct s3c24x0_i2c *i2c = s3c24x0_get_base_i2c();
 
 	return !(readl(&i2c->IICSTAT) & I2CSTAT_NACK);
 }
 
-static void ReadWriteByte(void)
+static void read_write_byte(void)
 {
 	struct s3c24x0_i2c *i2c = s3c24x0_get_base_i2c();
 
@@ -127,7 +120,7 @@ void i2c_init(int speed, int slaveadd)
 		i--;
 	}
 
-	if ((readl(&i2c->IICSTAT) & I2CSTAT_BSY) || GetI2CSDA() == 0) {
+	if ((readl(&i2c->IICSTAT) & I2CSTAT_BSY) || get_i2c_sda() == 0) {
 #ifdef CONFIG_S3C2410
 		ulong old_gpecon = readl(&gpio->GPECON);
 #endif
@@ -149,17 +142,17 @@ void i2c_init(int speed, int slaveadd)
 #endif
 
 		/* toggle I2CSCL until bus idle */
-		SetI2CSCL(0);
+		set_i2c_scl(0);
 		udelay(1000);
 		i = 10;
-		while ((i > 0) && (GetI2CSDA() != 1)) {
-			SetI2CSCL(1);
+		while ((i > 0) && (get_i2c_sda() != 1)) {
+			set_i2c_scl(1);
 			udelay(1000);
-			SetI2CSCL(0);
+			set_i2c_scl(0);
 			udelay(1000);
 			i--;
 		}
-		SetI2CSCL(1);
+		set_i2c_scl(1);
 		udelay(1000);
 
 		/* restore pin functions */
@@ -238,16 +231,16 @@ int i2c_transfer(unsigned char cmd_type,
 			       &i2c->IICSTAT);
 			i = 0;
 			while ((i < addr_len) && (result == I2C_OK)) {
-				result = WaitForXfer();
+				result = wait_for_xfer();
 				writel(addr[i], &i2c->IICDS);
-				ReadWriteByte();
+				read_write_byte();
 				i++;
 			}
 			i = 0;
 			while ((i < data_len) && (result == I2C_OK)) {
-				result = WaitForXfer();
+				result = wait_for_xfer();
 				writel(data[i], &i2c->IICDS);
-				ReadWriteByte();
+				read_write_byte();
 				i++;
 			}
 		} else {
@@ -257,19 +250,19 @@ int i2c_transfer(unsigned char cmd_type,
 			       &i2c->IICSTAT);
 			i = 0;
 			while ((i < data_len) && (result = I2C_OK)) {
-				result = WaitForXfer();
+				result = wait_for_xfer();
 				writel(data[i], &i2c->IICDS);
-				ReadWriteByte();
+				read_write_byte();
 				i++;
 			}
 		}
 
 		if (result == I2C_OK)
-			result = WaitForXfer();
+			result = wait_for_xfer();
 
 		/* send STOP */
 		writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->IICSTAT);
-		ReadWriteByte();
+		read_write_byte();
 		break;
 
 	case I2C_READ:
@@ -279,13 +272,13 @@ int i2c_transfer(unsigned char cmd_type,
 			/* send START */
 			writel(readl(&i2c->IICSTAT) | I2C_START_STOP,
 			       &i2c->IICSTAT);
-			result = WaitForXfer();
-			if (IsACK()) {
+			result = wait_for_xfer();
+			if (is_ack()) {
 				i = 0;
 				while ((i < addr_len) && (result == I2C_OK)) {
 					writel(addr[i], &i2c->IICDS);
-					ReadWriteByte();
-					result = WaitForXfer();
+					read_write_byte();
+					result = wait_for_xfer();
 					i++;
 				}
 
@@ -293,16 +286,16 @@ int i2c_transfer(unsigned char cmd_type,
 				/* resend START */
 				writel(I2C_MODE_MR | I2C_TXRX_ENA |
 				       I2C_START_STOP, &i2c->IICSTAT);
-				ReadWriteByte();
-				result = WaitForXfer();
+				read_write_byte();
+				result = wait_for_xfer();
 				i = 0;
 				while ((i < data_len) && (result == I2C_OK)) {
 					/* disable ACK for final READ */
 					if (i == data_len - 1)
 						writel(readl(&i2c->IICCON)
 						       & ~0x80, &i2c->IICCON);
-					ReadWriteByte();
-					result = WaitForXfer();
+					read_write_byte();
+					result = wait_for_xfer();
 					data[i] = readl(&i2c->IICDS);
 					i++;
 				}
@@ -316,17 +309,17 @@ int i2c_transfer(unsigned char cmd_type,
 			/* send START */
 			writel(readl(&i2c->IICSTAT) | I2C_START_STOP,
 			       &i2c->IICSTAT);
-			result = WaitForXfer();
+			result = wait_for_xfer();
 
-			if (IsACK()) {
+			if (is_ack()) {
 				i = 0;
 				while ((i < data_len) && (result == I2C_OK)) {
 					/* disable ACK for final READ */
 					if (i == data_len - 1)
 						writel(readl(&i2c->IICCON) &
 						       ~0x80, &i2c->IICCON);
-					ReadWriteByte();
-					result = WaitForXfer();
+					read_write_byte();
+					result = wait_for_xfer();
 					data[i] = readl(&i2c->IICDS);
 					i++;
 				}
@@ -337,7 +330,7 @@ int i2c_transfer(unsigned char cmd_type,
 
 		/* send STOP */
 		writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->IICSTAT);
-		ReadWriteByte();
+		read_write_byte();
 		break;
 
 	default:
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index c07a26e..6997a2b 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1197,7 +1197,6 @@ void logo_plot (void *screen, int width, int x, int y)
 static void *video_logo (void)
 {
 	char info[128];
-	extern char version_string;
 	int space, len, y_off = 0;
 
 #ifdef CONFIG_SPLASH_SCREEN
diff --git a/include/common.h b/include/common.h
index 07897f6..103c48c 100644
--- a/include/common.h
+++ b/include/common.h
@@ -216,6 +216,12 @@ int	display_options (void);
 void	print_size (phys_size_t, const char *);
 int	print_buffer (ulong addr, void* data, uint width, uint count, uint linelen);
 
+/* common/vfd.c */
+#if defined(CONFIG_CMD_VFD)
+int trab_vfd(ulong bitmap);
+void transfer_pic(int, unsigned char *, int, int);
+
+#endif
 /* common/main.c */
 void	main_loop	(void);
 int	run_command	(const char *cmd, int flag);
@@ -224,6 +230,7 @@ int	readline_into_buffer	(const char *const prompt, char * buffer);
 int	parse_line (char *, char *[]);
 void	init_cmd_timeout(void);
 void	reset_cmd_timeout(void);
+extern int do_mdm_init;
 
 /* lib_$(ARCH)/board.c */
 void	board_init_f  (ulong) __attribute__ ((noreturn));
@@ -234,6 +241,7 @@ int	checkdram     (void);
 int	last_stage_init(void);
 extern ulong monitor_flash_len;
 int mac_read_from_eeprom(void);
+extern const char version_string[];
 
 /* common/flash.c */
 void flash_perror (int);
@@ -478,6 +486,12 @@ void	_serial_puts   (const char *, const int);
 int	_serial_getc   (const int);
 int	_serial_tstc   (const int);
 
+#ifdef CONFIG_MODEM_SUPPORT
+void disable_putc(void);
+void enable_putc(void);
+int hwflow_onoff(int);
+#endif
+
 /* $(CPU)/speed.c */
 int	get_clocks (void);
 int	get_clocks_866 (void);
diff --git a/lib_generic/display_options.c b/lib_generic/display_options.c
index 2dc2567..a01f00f 100644
--- a/lib_generic/display_options.c
+++ b/lib_generic/display_options.c
@@ -28,8 +28,6 @@
 
 int display_options (void)
 {
-	extern char version_string[];
-
 #if defined(BUILD_TAG)
 	printf ("\n\n%s, Build: %s\n\n", version_string, BUILD_TAG);
 #else
-- 
1.6.1.2



More information about the U-Boot mailing list