2012/7/23 Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>:
> Quick hack to print a warning if we skip all blocks because they are already
> equal to the requested image. We want something like this to make users
> aware... and some developers that regularly fall for this too *coughcough*.
>
> Signed-off-by: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
> ---
> flashrom.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/flashrom.c b/flashrom.c
> index 70687ff..ebc3118 100644
> --- a/flashrom.c
> +++ b/flashrom.c
> @@ -1218,6 +1218,7 @@ static int selfcheck_eraseblocks(const struct flashchip *flash)
> return ret;
> }
>
> +static int all_skipped = 1;
> static int erase_and_write_block_helper(struct flashctx *flash,
> unsigned int start, unsigned int len,
> uint8_t *curcontents,
> @@ -1266,6 +1267,8 @@ static int erase_and_write_block_helper(struct flashctx *flash,
> }
> if (skip)
> msg_cdbg("S");
> + else
> + all_skipped = 0;
> return ret;
> }
>
> @@ -1391,6 +1394,8 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents,
> if (ret) {
> msg_cerr("FAILED!\n");
> } else {
> + if(all_skipped)
> + msg_cinfo("\nWarning: Chip contents were already identical to the requested image.\n");
I would change "were already identical" to "are identical". Let's not
(right now) digress about calling it chip contents or content.
> msg_cinfo("Erase/write done.\n");
> }
> return ret;
> --
> Kind regards, Stefan Tauner
After considering the above comment:
Acked-by: Idwer Vollering <vidwer(a)gmail.com>