Skip to contentSkip to conversation

s3c24x0 code-style clean-up

PATCH Superseded kevin.morfitt at fearnside-systems.co.uk 1 participant 1 message Dec 28, 2009

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 s3c24x0 code-style clean-up

Changes the s3c24x0 files to meet the code style requirements.

---

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
board/MAI/AmigaOneG3SE/video.c +0 -1
index e24e28b..e8d1f64 100644
@@ -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)
 {
board/mpl/common/common_util.h +1 -0
index 29cd14f..9978ce4 100644
@@ -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_ */
board/mpl/common/flash.c +0 -1
index 682f0e7..2e40610 100644
@@ -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 */
board/mpl/vcma9/cmd_vcma9.c +0 -9
index 49558d8..10dcd8e 100644
@@ -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[])
board/mpl/vcma9/vcma9.c +12 -15
index 9a7c0fa..5401664 100644
@@ -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)
board/mpl/vcma9/vcma9.h +4 -2
index e1ec1fe..adc7673 100644
@@ -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)
board/samsung/smdk2400/smdk2400.c +3 -9
index 5825ce9..a1b0e0c 100644
@@ -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;
 }
board/sbc2410x/sbc2410x.c +3 -3
index b7bbcf2..548852f 100644
@@ -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);
 }
board/trab/auto_update.c +9 -21
index bcb8505..4f30c23 100644
@@ -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;
board/trab/cmd_trab.c +93 -120

425 lines not on this page · raw message

board/trab/rs485.c +8 -8
index 2dfd202..79f8cc4 100644
@@ -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++);
-	}
 }
 
 /*
board/trab/trab.c +16 -27

130 lines not on this page · raw message

board/trab/trab.h new file +38 -0
new file mode 100644
index 0000000..9eb2702
@@ -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
+
board/trab/trab_fkt.c +140 -191

596 lines not on this page · raw message

board/trab/tsc2000.c +6 -6
index 27d90b2..2855825 100644
@@ -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 */;
 }
board/trab/tsc2000.h +1 -0
index c7ec0bd..db4b408 100644
@@ -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)
 {
board/trab/vfd.c +36 -34

170 lines not on this page · raw message

common/cmd_version.c +0 -2
index 7f165c7..3fd1d0c 100644
@@ -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);
common/cmd_vfd.c +0 -2
index 9c5b038..e65e212 100644
@@ -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[])
common/main.c +2 -3
index 10d8904..22bc020 100644
@@ -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 */
 
drivers/i2c/s3c24x0_i2c.c +32 -39

186 lines not on this page · raw message

drivers/video/cfb_console.c +0 -1
index c07a26e..6997a2b 100644
@@ -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
include/common.h +14 -0
index 07897f6..103c48c 100644
@@ -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);
lib_generic/display_options.c +0 -2
index 2dc2567..a01f00f 100644
@@ -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
Signature · 1 line
1.6.1.2