[flashrom] [PATCH 2/3] add check_block_erasers which returns the number of well-defined erasers for a chip

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Jun 30 19:54:47 CEST 2011


Am 24.06.2011 16:53 schrieb Stefan Tauner:
> This can be used in various situations (including one in the upcoming SFDP patch) and
> removes one FIXME in current HEAD. Needed to move check_block_eraser (which checks a
> single eraser) up to avoid (upcoming) forward declaration(s).
>   

Since nobody objected to the "forward declarations" RFC, I think we can
safely say that moving code around inside a file is a bad idea. Please
kill that part.


> Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
> ---
>  flashrom.c |   70 ++++++++++++++++++++++++++++++++++-------------------------
>  1 files changed, 40 insertions(+), 30 deletions(-)
>
> diff --git a/flashrom.c b/flashrom.c
> index 6979d84..aed10aa 100644
> --- a/flashrom.c
> +++ b/flashrom.c
> @@ @@
> +/* Returns the number of well-defined erasers for a chip.
> + * The log parameter controls output. */
> +static int check_block_erasers(const struct flashchip *flash, int log)
>   

Hm. Can you call it count_usable_erasers or count_usable_block_erasers
instead?


> +{
> +	int usable_erasefunctions = 0;
> +	int k;
> +	for (k = 0; k < NUM_ERASEFUNCTIONS; k++) {
> +		if (!check_block_eraser(flash, k, 0))
> +			usable_erasefunctions++;
> +	}
> +	return usable_erasefunctions;
> +}
> +
>   

Rest looks good to me.

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/





More information about the flashrom mailing list