mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 05/10] nand command: use enumeration for command instead of bitmask
Date: Mon, 4 Mar 2013 22:25:36 +0100	[thread overview]
Message-ID: <20130304212535.GF911@x61s.8.8.8.8> (raw)
In-Reply-To: <1362392034-1908-6-git-send-email-s.hauer@pengutronix.de>

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@pengutronix.de>
> ---
>  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@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-03-04 21:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 10:13 [PATCH] nand bad block erase and i.MX bbt tool Sascha Hauer
2013-03-04 10:13 ` [PATCH 01/10] mtd: nand: register nand flashes with nand specific function Sascha Hauer
2013-03-04 10:13 ` [PATCH 02/10] mtd: Add parameter to allow erasing bad blocks Sascha Hauer
2013-03-04 10:13 ` [PATCH 03/10] mtd nand: introduce bbm.h Sascha Hauer
2013-03-04 10:13 ` [PATCH 04/10] nand command: use loff_t for block offset Sascha Hauer
2013-03-04 10:13 ` [PATCH 05/10] nand command: use enumeration for command instead of bitmask Sascha Hauer
2013-03-04 21:25   ` Alexander Aring [this message]
2013-03-04 10:13 ` [PATCH 06/10] nand command: check for <dev> directly after option parsing Sascha Hauer
2013-03-04 10:13 ` [PATCH 07/10] mtd: nand: replace NAND_USE_FLASH_BBT with NAND_BBT_USE_FLASH Sascha Hauer
2013-03-04 10:13 ` [PATCH 08/10] mtd nand i.MX: remove unused code Sascha Hauer
2013-03-04 10:13 ` [PATCH 09/10] mtd: nand: Add bbt parameter Sascha Hauer
2013-03-04 20:42   ` Juergen Beisert
2013-03-05 10:48     ` Sascha Hauer
2013-03-04 10:13 ` [PATCH 10/10] mtd: nand: Add command to generate a flash BBT Sascha Hauer
2013-03-04 20:43   ` Juergen Beisert
2013-03-05 10:49     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130304212535.GF911@x61s.8.8.8.8 \
    --to=alex.aring@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox