]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
ARM: UniPhier: refactor pinmon command
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Thu, 5 Feb 2015 11:56:23 +0000 (20:56 +0900)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 10:59:08 +0000 (12:59 +0200)
The return value of get_boot_mode_sel() is used as the index of
the boot_device_table[] array.  Its type should be "int" rather
than "u32".

Use only the iterator "i" for the loop in do_pinmon().

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
arch/arm/cpu/armv7/uniphier/cmd_pinmon.c
arch/arm/cpu/armv7/uniphier/ph1-pro4/boot-mode.c
arch/arm/include/asm/arch-uniphier/boot-device.h

index 3561b40a33196deed9568fcf5fd57ddc1675c07b..d8a6361a46f3267780f6551a5ca836ce4b13a699 100644 (file)
 
 static int do_pinmon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-       struct boot_device_info *table;
-       u32 mode_sel, n = 0;
-
-       mode_sel = get_boot_mode_sel();
+       int mode_sel, i;
 
        printf("Boot Swap: %s\n\n", boot_is_swapped() ? "ON" : "OFF");
 
+       mode_sel = get_boot_mode_sel();
+
        puts("Boot Mode Pin:\n");
 
-       for (table = boot_device_table; strlen(table->info); table++) {
-               printf(" %c %02x %s\n", n == mode_sel ? '*' : ' ', n,
-                      table->info);
-               n++;
-       }
+       for (i = 0; strlen(boot_device_table[i].info); i++)
+               printf(" %c %02x %s\n", i == mode_sel ? '*' : ' ', i,
+                      boot_device_table[i].info);
 
        return 0;
 }
index 33bccff2a5e05ffe616f1c7a8a3a65ef1770b737..90d41865e924c2b7e83b9ad56c3d546037760bf1 100644 (file)
@@ -48,14 +48,14 @@ struct boot_device_info boot_device_table[] = {
        {BOOT_DEVICE_NONE, ""}
 };
 
-u32 get_boot_mode_sel(void)
+int get_boot_mode_sel(void)
 {
        return (readl(SG_PINMON0) >> 1) & 0x1f;
 }
 
 u32 spl_boot_device(void)
 {
-       u32 boot_mode;
+       int boot_mode;
 
        if (boot_is_swapped())
                return BOOT_DEVICE_NOR;
index 6987f5766960a7c4ab65f50973bf001f1f62d366..7a10f1c5b2c89db6a9f30f0552632cbf9c060f24 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef _ASM_BOOT_DEVICE_H_
 #define _ASM_BOOT_DEVICE_H_
 
-u32 get_boot_mode_sel(void);
+int get_boot_mode_sel(void);
 
 struct boot_device_info {
        u32 type;