diff options
author | Edward O'Callaghan <quasisec@google.com> | 2021-07-14 15:10:58 +1000 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2021-07-16 02:10:40 +0000 |
commit | 9fa68b0cfd2f8d148ae841ae5faeb86281b04b42 (patch) | |
tree | 2f52847ad0db6fba6960e5543a302a79a67a5b80 | |
parent | 4ebe65c73330b08fe6b8454af7810e022f94e26c (diff) | |
download | flashrom-9fa68b0cfd2f8d148ae841ae5faeb86281b04b42.tar.gz flashrom-9fa68b0cfd2f8d148ae841ae5faeb86281b04b42.tar.bz2 flashrom-9fa68b0cfd2f8d148ae841ae5faeb86281b04b42.zip |
flashrom.c: Reorder check_block_eraser() to avoid forward decl
Help make groking flashrom.c fractionaly easier.
BUG=none
BRANCH=none
TEST=builds
Change-Id: I0906a6e581ce5135b58f6acc6339908dfa770a59
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/56296
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | flashrom.c | 52 |
1 files changed, 25 insertions, 27 deletions
@@ -73,8 +73,6 @@ static int may_register_shutdown = 0; /* Did we change something or was every erase/write skipped (if any)? */ static bool all_skipped = true; -static int check_block_eraser(const struct flashctx *flash, int k, int log); - /* Register a function to be executed on programmer shutdown. * The advantage over atexit() is that you can supply a void pointer which will * be used as parameter to the registered function upon programmer shutdown. @@ -333,6 +331,31 @@ char *extract_programmer_param(const char *param_name) return extract_param(&programmer_param, param_name, ","); } +static int check_block_eraser(const struct flashctx *flash, int k, int log) +{ + struct block_eraser eraser = flash->chip->block_erasers[k]; + + if (!eraser.block_erase && !eraser.eraseblocks[0].count) { + if (log) + msg_cdbg("not defined. "); + return 1; + } + if (!eraser.block_erase && eraser.eraseblocks[0].count) { + if (log) + msg_cdbg("eraseblock layout is known, but matching " + "block erase function is not implemented. "); + return 1; + } + if (eraser.block_erase && !eraser.eraseblocks[0].count) { + if (log) + msg_cdbg("block erase function found, but " + "eraseblock layout is not defined. "); + return 1; + } + // TODO: Once erase functions are annotated with allowed buses, check that as well. + return 0; +} + /* Returns the number of well-defined erasers for a chip. */ static unsigned int count_usable_erasers(const struct flashctx *flash) { @@ -1125,31 +1148,6 @@ static int selfcheck_eraseblocks(const struct flashchip *chip) return ret; } -static int check_block_eraser(const struct flashctx *flash, int k, int log) -{ - struct block_eraser eraser = flash->chip->block_erasers[k]; - - if (!eraser.block_erase && !eraser.eraseblocks[0].count) { - if (log) - msg_cdbg("not defined. "); - return 1; - } - if (!eraser.block_erase && eraser.eraseblocks[0].count) { - if (log) - msg_cdbg("eraseblock layout is known, but matching " - "block erase function is not implemented. "); - return 1; - } - if (eraser.block_erase && !eraser.eraseblocks[0].count) { - if (log) - msg_cdbg("block erase function found, but " - "eraseblock layout is not defined. "); - return 1; - } - // TODO: Once erase functions are annotated with allowed buses, check that as well. - return 0; -} - /** * @brief Reads the included layout regions into a buffer. * |