9
0
Fork 0

scripts/kwbimage: add a new function image_count_options()

This function returns the number of configuration elements that match
a given type. Will be used to do some sanity checking of the number of
options.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Thomas Petazzoni 2013-05-15 09:36:27 +02:00 committed by Sascha Hauer
parent 2434ae9f50
commit 87f6faa450
1 changed files with 14 additions and 0 deletions

View File

@ -259,6 +259,20 @@ image_find_option(struct image_cfg_element *image_cfg,
return NULL;
}
static unsigned int
image_count_options(struct image_cfg_element *image_cfg,
int cfgn, unsigned int optiontype)
{
int i;
unsigned int count = 0;
for (i = 0; i < cfgn; i++)
if (image_cfg[i].type == optiontype)
count++;
return count;
}
/*
* Compute a 8-bit checksum of a memory area. This algorithm follows
* the requirements of the Marvell SoC BootROM specifications.