Hi, On Mon, Mar 04, 2013 at 11:13:49AM +0100, Sascha Hauer wrote: > A command can only be one of NAND_*, so use an enumeration instead > of a bitmask. > > Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> > --- > commands/nand.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/commands/nand.c b/commands/nand.c > index d00845f..79f6735 100644 > --- a/commands/nand.c > +++ b/commands/nand.c > @@ -29,9 +29,9 @@ > #include <fcntl.h> > #include <libgen.h> > > -#define NAND_ADD (1 << 0) > -#define NAND_DEL (1 << 1) > -#define NAND_MARKBAD (1 << 2) > +#define NAND_ADD 1 > +#define NAND_DEL 2 > +#define NAND_MARKBAD 3 > > static int do_nand(int argc, char *argv[]) > { > @@ -58,7 +58,7 @@ static int do_nand(int argc, char *argv[]) > } > } > > - if (command & NAND_ADD) { > + if (command == NAND_ADD) { some nitpick. Can we use switch case instead of if? With a default branch when command == 0 to return COMMAND_ERROR_USAGE? > while (optind < argc) { > if (dev_add_bb_dev(basename(argv[optind]), NULL)) > return 1; > @@ -67,14 +67,14 @@ static int do_nand(int argc, char *argv[]) > } > } > > - if (command & NAND_DEL) { > + if (command == NAND_DEL) { > while (optind < argc) { > dev_remove_bb_dev(basename(argv[optind])); > optind++; > } > } > > - if (command & NAND_MARKBAD) { > + if (command == NAND_MARKBAD) { > if (optind < argc) { > int ret = 0, fd; > > -- > 1.7.10.4 > > > _______________________________________________ > barebox mailing list > barebox@xxxxxxxxxxxxxxxxxxx > http://lists.infradead.org/mailman/listinfo/barebox _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox