Edward O'Callaghan has uploaded this change for review.

View Change

flashrom.c: Confine is_internal checks under a symbol

We wish for printers to be parametric on the flag state
of if we are internal or not and not embed this side-effect.

Change-Id: I569811798bfe310c59b8b61afba359bef68969fb
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M flashrom.c
1 file changed, 22 insertions(+), 9 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/75/67475/1
diff --git a/flashrom.c b/flashrom.c
index 0f07e44..402ba94 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1307,10 +1307,10 @@
#endif
}

-static void nonfatal_help_message(void)
+static void nonfatal_help_message(bool is_internal)
{
msg_gerr("Good, writing to the flash chip apparently didn't do anything.\n");
- if (is_internal_programmer())
+ if (is_internal)
msg_gerr("This means we have to add special support for your board, programmer or flash\n"
"chip. Please report this to the mailing list at flashrom@flashrom.org or on\n"
"IRC (see https://www.flashrom.org/Contact for details), thanks!\n"
@@ -1323,10 +1323,10 @@
"https://www.flashrom.org/Contact for details), thanks!\n");
}

-static void emergency_help_message(void)
+static void emergency_help_message(bool is_internal)
{
msg_gerr("Your flash chip is in an unknown state.\n");
- if (is_internal_programmer())
+ if (is_internal)
msg_gerr("Get help on IRC (see https://www.flashrom.org/Contact) or mail\n"
"flashrom@flashrom.org with the subject \"FAILED: <your board name>\"!"
"-------------------------------------------------------------------------------\n"
@@ -1609,7 +1609,7 @@
* knows very well that booting won't work.
*/
if (ret)
- emergency_help_message();
+ emergency_help_message(is_internal_programmer());
return ret;
}

@@ -1741,18 +1741,18 @@
if (!flashctx->chip->read(flashctx, curcontents, 0, flash_size)) {
msg_cinfo("done.\n");
if (!memcmp(oldcontents, curcontents, flash_size)) {
- nonfatal_help_message();
+ nonfatal_help_message(is_internal_programmer());
goto _finalize_ret;
}
msg_cerr("Apparently at least some data has changed.\n");
} else
msg_cerr("Can't even read anymore!\n");
- emergency_help_message();
+ emergency_help_message(is_internal_programmer());
goto _finalize_ret;
} else {
msg_cerr("\n");
}
- emergency_help_message();
+ emergency_help_message(is_internal_programmer());
goto _finalize_ret;
}

@@ -1769,7 +1769,7 @@
/* If we tried to write, and verification now fails, we
might have an emergency situation. */
if (ret)
- emergency_help_message();
+ emergency_help_message(is_internal_programmer());
else
msg_cinfo("VERIFIED.\n");
} else {

To view, visit change 67475. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I569811798bfe310c59b8b61afba359bef68969fb
Gerrit-Change-Number: 67475
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange