Edward O'Callaghan submitted this change.
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>
---
M flashrom.c
1 file changed, 25 insertions(+), 27 deletions(-)
diff --git a/flashrom.c b/flashrom.c
index 1f94f33..8d44c3d 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -73,8 +73,6 @@
/* 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 @@
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 @@
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.
*
To view, visit change 56296. To unsubscribe, or for help writing mail filters, visit settings.