public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Holger Brunck <holger.brunck@keymile.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 23/30] km/common: replace env var checkboardidlist by function
Date: Mon, 02 May 2011 10:30:09 +0200	[thread overview]
Message-ID: <4DBE6B91.7090008@keymile.com> (raw)
In-Reply-To: <20110430082953.88C33D5270E@gemini.denx.de>

Hello,

On 04/30/2011 10:29 AM, Wolfgang Denk wrote:
> Dear Valentin Longchamp,
> 
> In message <e341fcb668eb67e1eb44ea638e96f9bb514c8bfb.1302272395.git.valentin.longchamp@keymile.com> you wrote:
>> From: Thomas Herzmann <thomas.herzmann@keymile.com>
>>
>> The environment variable (defining a checkboardidlist function)
>> has been replaced by a u-boot function call. This call is much
>> faster and the environment is a leaner.
> ...
>> +	p = get_local_var("IVM_BoardId");
>> +	strict_strtoul(p, 16, &ivmbid);
>> +	p = get_local_var("IVM_HWKey");
>> +	strict_strtoul(p, 16, &ivmhwkey);
> 
> Error handling missing.
> 

Ok.

>> +			while (!found) {
>> +				/* loop over each bid/hwkey pair in the list */
>> +				unsigned long bid   = 0;
>> +				unsigned long hwkey = 0;
>> +				while (*rest && !isxdigit(*rest))
>> +					rest++;
>> +				bid = simple_strtoul(rest, &endp, 16);
>> +				if (*endp == '_') {
>> +					rest  = endp + 1;
>> +					hwkey =	simple_strtoul(rest, &endp, 16);
>> +					rest  = endp;
>> +					while (*rest && !isxdigit(*rest))
>> +						rest++;
>> +				}
>> +				if ((!bid) || (!hwkey)) {
>> +					/* end of list */
>> +					break;
>> +				}
>> +				if (verbose) {
>> +					printf("trying bid=0x%lX, hwkey=%ld\n",
>> +						bid, hwkey);
>> +				}
>> +				if ((bid == ivmbid) && (hwkey == ivmhwkey)) {
>> +					char buf[10];
>> +
>> +					found = 1;
>> +					envbid   = bid;
>> +					envhwkey = hwkey;
>> +					sprintf(buf, "%lx", bid);
>> +					setenv("boardid", buf);
>> +					sprintf(buf, "%lx", hwkey);
>> +					setenv("hwkey", buf);
>> +					saveenv();
>> +				}
> 
> How well has this code been tested?  I may not understand it correctly
> (which might be an indication that some comments are missing that
> actually explain what you are doing), or there might be some unhandled
> error cases.
> 

It is tested on our boards. But indeed the commit message should be better to be
able to understand the functionality. Additionaly we check if additionaly some
error cases are not handled.

Best regards
Holger Brunck

  reply	other threads:[~2011-05-02  8:30 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08 14:23 [U-Boot] [PATCH 00/30] Keymile boards mainlining, part 2 (resend) Valentin Longchamp
2011-04-08 14:23 ` [U-Boot] [PATCH 01/30] lib, vsprintf: introduce strict_strtoul Valentin Longchamp
2011-04-29 23:15   ` Wolfgang Denk
2011-05-03  7:33   ` [U-Boot] [PATCH v2] " Heiko Schocher
2011-05-12 19:07     ` Wolfgang Denk
2011-04-08 14:23 ` [U-Boot] [PATCH 02/30] powerpc/km82xx: add DIP switch detection Valentin Longchamp
2011-04-08 14:23 ` [U-Boot] [PATCH 03/30] km/common: remove hdlc_enet implementation Valentin Longchamp
2011-04-08 14:23 ` [U-Boot] [PATCH 04/30] powerpc/km82xx: cleanup coding style for mgcoge.c Valentin Longchamp
2011-04-08 14:23 ` [U-Boot] [PATCH 05/30] powerpc/km82xx: rename mgcoge files to km82xx Valentin Longchamp
2011-04-08 14:23 ` [U-Boot] [PATCH 06/30] powerpc/km82xx: move SDRAM config to board config Valentin Longchamp
2011-04-30  7:56   ` Wolfgang Denk
2011-05-02  8:04     ` Holger Brunck
2011-05-02  8:39       ` Wolfgang Denk
2011-04-08 14:23 ` [U-Boot] [PATCH 07/30] powerpc/km82xx: adapt CONFIG_SYSSYPCR to manual Valentin Longchamp
2011-04-08 14:23 ` [U-Boot] [PATCH 08/30] powerpc/km82xx: rename mgcoge2ne to mgcoge3ne board support Valentin Longchamp
2011-04-30  8:05   ` Wolfgang Denk
2011-05-02  8:20     ` Holger Brunck
2011-05-02  8:42       ` Wolfgang Denk
2011-05-02  9:22         ` Holger Brunck
2011-05-10 20:45           ` Wolfgang Denk
2011-04-08 14:23 ` [U-Boot] [PATCH 09/30] poweprc/km82xx: add board specific environment variable Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 10/30] arm/km: add addbootcount " Valentin Longchamp
2011-04-30  8:09   ` Wolfgang Denk
2011-05-02  8:22     ` Holger Brunck
2011-04-08 14:24 ` [U-Boot] [PATCH 11/30] arm/km: remove last_stage_init and unneeded printouts Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 12/30] arm/km: add CRAMFS support for keymile boards Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 13/30] arm/km: add mkimage config file for uart download Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 14/30] arm/km: add BootROM config files for memphis SDRAM Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 15/30] arm/km: disable ls (through jffs2 support) Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 16/30] arm/km: add second serial interface for kirkwood Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 17/30] cramfs: make cramfs usable without a NOR flash Valentin Longchamp
2011-04-30  8:20   ` Wolfgang Denk
2011-05-03  5:49     ` Heiko Schocher
2011-05-03 11:48       ` Wolfgang Denk
2011-05-03 12:15   ` [U-Boot] [PATCH v2 1/2] cramfs: fix bug in using CONFIG_CRAMFS_CMDLINE Heiko Schocher
2011-05-10 20:47     ` Wolfgang Denk
2011-05-03 12:15   ` [U-Boot] [PATCH v2 2/2] cramfs: make cramfs usable without a NOR flash Heiko Schocher
2011-05-10 20:47     ` Wolfgang Denk
2011-04-08 14:24 ` [U-Boot] [PATCH 18/30] i2c: add i2c deblock sequence before and after every mux config Valentin Longchamp
2011-04-28 17:26   ` Heiko Schocher
2011-04-08 14:24 ` [U-Boot] [PATCH 19/30] i2c, soft_i2c: deblock bus if switching to another i2c bus Valentin Longchamp
2011-04-28 17:26   ` Heiko Schocher
2011-04-08 14:24 ` [U-Boot] [PATCH 20/30] km/common: fix initial_boot_bank for bootpackages Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 21/30] common/hush: make get_local_var visible for other users Valentin Longchamp
2011-04-30  8:22   ` Wolfgang Denk
2011-05-02  5:23     ` Heiko Schocher
2011-05-02  5:40       ` Wolfgang Denk
2011-04-08 14:24 ` [U-Boot] [PATCH 22/30] km/common: implement setboardid as a command Valentin Longchamp
2011-04-30  8:25   ` Wolfgang Denk
2011-05-02  7:32     ` Holger Brunck
2011-04-08 14:24 ` [U-Boot] [PATCH 23/30] km/common: replace env var checkboardidlist by function Valentin Longchamp
2011-04-30  8:29   ` Wolfgang Denk
2011-05-02  8:30     ` Holger Brunck [this message]
2011-05-02  8:43       ` Wolfgang Denk
2011-04-08 14:24 ` [U-Boot] [PATCH 24/30] km/common: add pnvramsize to default environment Valentin Longchamp
2011-04-30  8:32   ` Wolfgang Denk
2011-05-02  7:41     ` Holger Brunck
2011-04-08 14:24 ` [U-Boot] [PATCH 25/30] km/common: fix coding style issues in generic header Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 26/30] arm, powerpc, keymile boards: move keymile specific header in subdir Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 27/30] km/common: simplify default environment Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 28/30] arm/km: rename mgcoge2un to mgcoge3un Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 29/30] arm/km: change default settings for egiga on mgcoge3un Valentin Longchamp
2011-04-08 14:24 ` [U-Boot] [PATCH 30/30] arm/km: update mgcoge3un board support Valentin Longchamp
2011-05-03  8:17 ` [U-Boot] [PATCH 00/30] Keymile boards mainlining, part 2 (resend) Valentin Longchamp

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=4DBE6B91.7090008@keymile.com \
    --to=holger.brunck@keymile.com \
    --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