Use strncmp() for the fdt command

Cleaner than doing multiple conditionals on characters.

Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
master
Gerald Van Baren 16 years ago
parent 47abe8ab29
commit 2fb698bf50
  1. 16
      common/cmd_fdt.c

@ -94,7 +94,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
/******************************************************************** /********************************************************************
* Move the fdt * Move the fdt
********************************************************************/ ********************************************************************/
} else if ((argv[1][0] == 'm') && (argv[1][1] == 'o')) { } else if (strncmp(argv[1], "mo", 2) == 0) {
struct fdt_header *newaddr; struct fdt_header *newaddr;
int len; int len;
int err; int err;
@ -144,7 +144,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
/******************************************************************** /********************************************************************
* Make a new node * Make a new node
********************************************************************/ ********************************************************************/
} else if ((argv[1][0] == 'm') && (argv[1][1] == 'k')) { } else if (strncmp(argv[1], "mk", 2) == 0) {
char *pathp; /* path */ char *pathp; /* path */
char *nodep; /* new node to add */ char *nodep; /* new node to add */
int nodeoffset; /* node offset from libfdt */ int nodeoffset; /* node offset from libfdt */
@ -259,7 +259,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
/******************************************************************** /********************************************************************
* Remove a property/node * Remove a property/node
********************************************************************/ ********************************************************************/
} else if ((argv[1][0] == 'r') && (argv[1][1] == 'm')) { } else if (strncmp(argv[1], "rm", 2) == 0) {
int nodeoffset; /* node offset from libfdt */ int nodeoffset; /* node offset from libfdt */
int err; int err;
@ -323,15 +323,14 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
/******************************************************************** /********************************************************************
* Set boot cpu id * Set boot cpu id
********************************************************************/ ********************************************************************/
} else if ((argv[1][0] == 'b') && (argv[1][1] == 'o') && } else if (strncmp(argv[1], "boo", 3) == 0) {
(argv[1][2] == 'o')) {
unsigned long tmp = simple_strtoul(argv[2], NULL, 16); unsigned long tmp = simple_strtoul(argv[2], NULL, 16);
fdt_set_boot_cpuid_phys(fdt, tmp); fdt_set_boot_cpuid_phys(fdt, tmp);
/******************************************************************** /********************************************************************
* memory command * memory command
********************************************************************/ ********************************************************************/
} else if ((argv[1][0] == 'm') && (argv[1][1] == 'e')) { } else if (strncmp(argv[1], "me", 2) == 0) {
uint64_t addr, size; uint64_t addr, size;
int err; int err;
#ifdef CFG_64BIT_STRTOUL #ifdef CFG_64BIT_STRTOUL
@ -348,7 +347,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
/******************************************************************** /********************************************************************
* mem reserve commands * mem reserve commands
********************************************************************/ ********************************************************************/
} else if ((argv[1][0] == 'r') && (argv[1][1] == 's')) { } else if (strncmp(argv[1], "rs", 2) == 0) {
if (argv[2][0] == 'p') { if (argv[2][0] == 'p') {
uint64_t addr, size; uint64_t addr, size;
int total = fdt_num_mem_rsv(fdt); int total = fdt_num_mem_rsv(fdt);
@ -403,8 +402,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
} }
#ifdef CONFIG_OF_BOARD_SETUP #ifdef CONFIG_OF_BOARD_SETUP
/* Call the board-specific fixup routine */ /* Call the board-specific fixup routine */
else if ((argv[1][0] == 'b') && (argv[1][1] == 'o') && else if (strncmp(argv[1], "boa", 3) == 0)
(argv[1][2] == 'a'))
ft_board_setup(fdt, gd->bd); ft_board_setup(fdt, gd->bd);
#endif #endif
/* Create a chosen node */ /* Create a chosen node */

Loading…
Cancel
Save