public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [Patch 5/9 Try 3]U-boot-V2:cmd: add I2C commands
Date: Tue, 24 Jun 2008 08:18:24 +0200	[thread overview]
Message-ID: <20080624061824.GA11384@pengutronix.de> (raw)
In-Reply-To: <7A436F7769CA33409C6B44B358BFFF0CD32815DC@dlee02.ent.ti.com>

On Sun, Jun 22, 2008 at 01:56:12PM -0500, Menon, Nishanth wrote:
> i2cdev command is introduced here. This allows
> for device creation for doing i2c ops. With tab
> indents corrected.

Nice and short ;) , just one comment...

 +
> +       while ((opt = getopt(argc, argv, "arb:d:")) > 0) {
> +               switch (opt) {
> +               case 'a':
> +                       if (rem) {
> +                               fprintf(stderr,
> +                                       "you cannot add when you selected "
> +                                       "delete!\n");
> +                               goto fail_ret;
> +                       }
> +                       add = 1;
> +                       break;
> +               case 'r':
> +                       if (add) {
> +                               fprintf(stderr,
> +                                       "you cannot delete when you selected "
> +                                       "add!\n");
> +                               goto fail_ret;
> +                       }
> +                       rem = 1;
> +                       break;
> +               case 'b':
> +                       bus_dev = optarg;
> +                       break;
> +               case 'd':
> +                       dev_addr = (int)simple_strtoul(optarg, NULL, 10);
> +                       if (dev_addr > 0xFF) {
> +                               fprintf(stderr, "I2C address are b/w 0 and "
> +                                       "0x7f\n");
> +                               goto fail_ret;
> +                       }
> +                       break;
> +               default:
> +                       fprintf(stderr, "unknown arg %s\n", opt);
> +                       goto fail_ret;
> +               }
> +       }

Instead of two seperate if claues above:

if (add && rem) {
	printf("both remove and add are selected\n");
	goto fail_ret;
}

Regards,
   Sascha

-- 
Pengutronix e.K. - Linux Solutions for Science and Industry
-----------------------------------------------------------
Kontakt-Informationen finden Sie im Header dieser Mail oder
auf der Webseite -> http://www.pengutronix.de/impressum/ <-

  reply	other threads:[~2008-06-24  6:18 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18 12:33 [U-Boot-Users] [Patch 0/9] U-boot-V2: Introduce I2C support for SDP3430 Menon, Nishanth
2008-06-18 14:55 ` Timur Tabi
2008-06-18 15:15   ` Menon, Nishanth
2008-06-18 15:28     ` Sascha Hauer
2008-06-18 15:40       ` Menon, Nishanth
2008-06-18 15:39     ` Timur Tabi
2008-06-18 15:52       ` Menon, Nishanth
2008-06-18 15:58       ` Sascha Hauer
2008-06-18 16:04         ` Menon, Nishanth
2008-06-18 18:38           ` Robert Schwebel
2008-06-18 18:48             ` Menon, Nishanth
2008-06-18 19:11               ` Robert Schwebel
2008-06-18 20:21                 ` Menon, Nishanth
2008-06-18 20:44                   ` Robert Schwebel
2008-06-18 20:52                     ` Menon, Nishanth
2008-06-19 15:10                     ` Menon, Nishanth
2008-06-19 15:11                     ` [U-Boot-Users] [Patch 1/9]U-boot-V2:ID: Add i2c_device_id Menon, Nishanth
2008-06-19 15:11                     ` [U-Boot-Users] [Patch 2/9]U-boot-V2:ID: Introduce idr Menon, Nishanth
2008-06-19 15:11                     ` [U-Boot-Users] [Patch 3/9]U-boot-V2:I2C: Introduce core Menon, Nishanth
2008-06-19 15:12                     ` [U-Boot-Users] [Patch 4/9]U-boot-V2:I2C: Introduce i2c-dev Menon, Nishanth
2008-06-19 15:12                     ` [U-Boot-Users] [Patch 5/9]U-boot-V2:cmd: add I2C commands Menon, Nishanth
2008-06-19 20:33                       ` Wolfgang Denk
2008-06-20  2:10                         ` Menon, Nishanth
2008-06-20  7:28                           ` Wolfgang Denk
2008-06-20 10:28                       ` Sascha Hauer
2008-06-20 13:35                         ` Menon, Nishanth
2008-06-20 15:16                           ` Sascha Hauer
2008-06-20 16:28                             ` Menon, Nishanth
2008-06-23  7:39                               ` Sascha Hauer
2008-06-23 13:29                                 ` Menon, Nishanth
2008-06-21  2:34                             ` [U-Boot-Users] [Patch 4/9 Try 2]U-boot-V2:I2C: Introduce i2c-dev Menon, Nishanth
2008-06-24  8:05                               ` Sascha Hauer
2008-06-25  1:48                                 ` [U-Boot-Users] [Patch 4/9 Try 3]U-boot-V2:I2C: " Menon, Nishanth
2008-06-21  2:34                             ` [U-Boot-Users] [Patch 5/9 Try2]U-boot-V2:cmd: add I2C commands Menon, Nishanth
2008-06-21  7:23                               ` Wolfgang Denk
2008-06-22 18:56                                 ` [U-Boot-Users] [Patch 5/9 Try 3]U-boot-V2:cmd: " Menon, Nishanth
2008-06-24  6:18                                   ` Sascha Hauer [this message]
2008-06-25  1:46                                     ` [U-Boot-Users] [Patch 5/9 Try 4]U-boot-V2:cmd: " Menon, Nishanth
2008-06-19 15:12                     ` [U-Boot-Users] [Patch 6/9]U-boot-V2:cmd: I2C commands support Menon, Nishanth
2008-06-19 15:13                     ` [U-Boot-Users] [Patch 7/9]U-boot-V2:ARM:OMAP: OMAP classes Menon, Nishanth
2008-06-19 15:13                     ` [U-Boot-Users] [Patch 8/9]U-boot-V2:I2C:Busses: OMAP I2C Adapter Menon, Nishanth
2008-06-19 15:13                     ` [U-Boot-Users] [Patch 9/9]U-boot-V2:Boards:SDP3430 I2C bus1 Menon, Nishanth
2008-06-18 18:41       ` [U-Boot-Users] [Patch 0/9] U-boot-V2: Introduce I2C support for SDP3430 Robert Schwebel

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=20080624061824.GA11384@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=u-boot@lists.denx.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