Brian Norris has uploaded this change for review.
cli_classic: Defer flashrom_init calibration until after options parsing
flashrom_init() may run through an expensive delay calibration phase,
depending on the system timer behavior (e.g., if high resolution timers
are disabled). This is wholly unnecessary if we're only going to dump
usage output or similar.
Defer the calibration until we've finished our CLI overhead.
BUG=b:325539928
TEST=`flashrom --help` with `sysctl kernel.timer_highres` == 0
Change-Id: I57949ab511df04c6922008fa8cb12467154e2c5e
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
M cli_classic.c
1 file changed, 4 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/72/80772/1
diff --git a/cli_classic.c b/cli_classic.c
index 60f3fd5..ffded5f 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -917,10 +917,6 @@
print_version();
print_banner();
- /* FIXME: Delay calibration should happen in programmer code. */
- if (flashrom_init(1))
- exit(1);
-
setbuf(stdout, NULL);
parse_options(argc, argv, optstring, long_options, &options);
@@ -1005,6 +1001,10 @@
}
}
+ /* FIXME: Delay calibration should happen in programmer code. */
+ if (flashrom_init(1))
+ exit(1);
+
if (programmer_init(options.prog, options.pparam)) {
msg_perr("Error: Programmer initialization failed.\n");
ret = 1;
To view, visit change 80772. To unsubscribe, or for help writing mail filters, visit settings.