From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] Add 'led' command
Date: Tue, 9 Nov 2010 08:52:24 -0500 [thread overview]
Message-ID: <201011090852.25053.vapier@gentoo.org> (raw)
In-Reply-To: <1288936236-30603-1-git-send-email-jkridner@beagleboard.org>
On Friday, November 05, 2010 01:50:36 Jason Kridner wrote:
> +int do_led ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] )
much of the style of this code is broken. and i cant imagine this code
compiling warning free with current master.
no spaces around the paren, and the argv has been constified.
also, this should be marked static
> + if ((argc != 3)){
space before the brace and useless set of paren here
> + printf("Usage:\n%s\n", cmdtp->usage);
> + return 1;
return cmd_usage(cmdtp);
> + if (strcmp(argv[2], "off") == 0) {
> + state = 0;
> + } else if (strcmp(argv[2], "on") == 0) {
> + state = 1;
i could have sworn we had a helper somewhere to handle "boolean strings" ...
> + printf ("Usage:\n%s\n", cmdtp->usage);
> + return 1;
return cmd_usage(cmdtp);
> +#if defined(STATUS_LED_BIT) && defined(CONFIG_BOARD_SPECIFIC_LED)
> + if (strcmp(argv[1], "0") == 0) {
> + mask = STATUS_LED_BIT;
> + __led_set(mask, state);
> + }
> + else
> +#endif
> +#if defined(STATUS_LED_BIT1) && defined(CONFIG_BOARD_SPECIFIC_LED)
> + if (strcmp(argv[1], "1") == 0) {
> + mask = STATUS_LED_BIT1;
> + __led_set(mask, state);
> + }
> + else
> +#endif
> +#if defined(STATUS_LED_BIT2) && defined(CONFIG_BOARD_SPECIFIC_LED)
> + if (strcmp(argv[1], "2") == 0) {
> + mask = STATUS_LED_BIT2;
> + __led_set(mask, state);
> + }
> + else
> +#endif
> +#if defined(STATUS_LED_BIT3) && defined(CONFIG_BOARD_SPECIFIC_LED)
> + if (strcmp(argv[1], "3") == 0) {
> + mask = STATUS_LED_BIT3;
> + __led_set(mask, state);
> + }
> + else
> +#endif
i dont know why you need the mask variable here at all
also, these #ifdef trees scream for some sort of unification
> + } else {
> + printf ("Usage:\n%s\n", cmdtp->usage);
> + return 1;
return cmd_usage(cmptp);
> +
files should not have trailing new lines
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101109/4f9a2022/attachment.pgp
next prev parent reply other threads:[~2010-11-09 13:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-05 5:50 [U-Boot] [RFC] Add 'led' command Jason Kridner
2010-11-05 12:21 ` Wolfgang Denk
2010-11-05 13:13 ` Reinhard Meyer
2010-11-05 17:04 ` Jason Kridner
2011-12-13 23:55 ` Ulf Samuelsson
2011-12-14 19:11 ` Simon Glass
[not found] ` <4EE8FB51.8010108@telia.com>
2011-12-14 21:31 ` Simon Glass
2011-12-15 18:17 ` Jason Kridner
2011-12-16 7:58 ` Ulf Samuelsson
2010-11-09 13:52 ` Mike Frysinger [this message]
2010-11-12 14:42 ` Jason Kridner
2010-11-13 23:31 ` Mike Frysinger
2010-11-18 10:37 ` Mike Frysinger
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=201011090852.25053.vapier@gentoo.org \
--to=vapier@gentoo.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.