From: Sascha Hauer Date: Tue, 24 Jun 2008 08:18:24 +0200 Subject: [U-Boot-Users] [Patch 5/9 Try 3]U-boot-V2:cmd: add I2C commands In-Reply-To: <7A436F7769CA33409C6B44B358BFFF0CD32815DC@dlee02.ent.ti.com> References: <7A436F7769CA33409C6B44B358BFFF0CD32814D8@dlee02.ent.ti.com> <20080621072324.828C824040@gemini.denx.de> <7A436F7769CA33409C6B44B358BFFF0CD32815DC@dlee02.ent.ti.com> Message-ID: <20080624061824.GA11384@pengutronix.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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/ <-