[U-Boot] [PATCH ARM 2/3 v2] s3c24x0 code style changes

Minkyu Kang promsoft at gmail.com
Thu Feb 11 09:37:15 CET 2010


Dear Kevin Morfitt,

On 11 February 2010 00:20, Kevin Morfitt
<kevin.morfitt at fearnside-systems.co.uk> wrote:
> Changes the s3c24x0 files to meet the code style requirements.
>
> Signed-off-by: Kevin Morfitt <kevin.morfitt at fearnside-systems.co.uk>
> ---
>
> v2 changes:
> - re-number to be 2/3
>
> 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[]);
> -
>  /* ------------------------------------------------------------------------- */
>

removing extern functions and values are ok.
but I wonder if it occur compile warnings.
Did you test it?

>  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)

Do you have plan for clean up such upper case function names?

> @@ -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 */

Please remove this if (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/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;

return !compare_magic(KBD_DATA, CONFIG_MODEM_KEY_MAGIC); is better.

>  }
>  #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);
>  }

Thanks
Minkyu Kang
-- 
from. prom.
www.promsoft.net


More information about the U-Boot mailing list