[coreboot] [PATCH] v2: Use ARRAY_SIZE everywhere
Uwe Hermann
uwe at hermann-uwe.de
Tue Aug 26 00:09:01 CEST 2008
On Fri, Aug 22, 2008 at 04:18:09PM +0200, Carl-Daniel Hailfinger wrote:
> The ARRAY_SIZE macro is convenient, yet mostly unused. Switch lots of
> code to use it. That makes the code more readable and also less error-prone.
>
> I'd appreciate test builds. I see v3 as the future and occassional
> patches to v2 are only intended to keep v2 roughly up to date with v3
> code changes.
>
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Looks good, but I only want to ack if this was build-tested with abuild
and some sample payloads for all boards.
Did you check that stdlib.h is included everywhere where ARRAY_SIZE is
used after the patch? Otherwise I expect compile errors.
> Index: LinuxBIOSv2-array_size/src/southbridge/amd/cs5536/cs5536.c
> ===================================================================
> --- LinuxBIOSv2-array_size/src/southbridge/amd/cs5536/cs5536.c (Revision 3513)
> +++ LinuxBIOSv2-array_size/src/southbridge/amd/cs5536/cs5536.c (Arbeitskopie)
> @@ -93,7 +93,7 @@
> {FLASH_TYPE_NONE, 0, 0}, /* CS3, or Flash Device 3 */
> };
>
> -#define FlashInitTableLen (sizeof(FlashInitTable)/sizeof(FlashInitTable[0]))
> +#define FlashInitTableLen (ARRAY_SIZE(FlashInitTable))
>
> uint32_t FlashPort[] = {
> MDD_LBAR_FLSH0,
Uwe.
--
http://www.hermann-uwe.de | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
More information about the coreboot
mailing list