summaryrefslogtreecommitdiffstats
path: root/internal.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2022-12-27 11:00:13 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2023-03-28 00:36:36 +0000
commit50f812cfc705743a46132f54057b42e71d0f6350 (patch)
treefe3d339625df343fcd859b85d4da895dc4235f7a /internal.c
parentc65379cba274fe4c6fd1054079d19ebb628e04d3 (diff)
downloadflashrom-50f812cfc705743a46132f54057b42e71d0f6350.tar.gz
flashrom-50f812cfc705743a46132f54057b42e71d0f6350.tar.bz2
flashrom-50f812cfc705743a46132f54057b42e71d0f6350.zip
dmi.c: Pass is_laptop by ref into dmi
Prefix the remaining global cases with `g_` to avoid shadowing issues and for easy greping. Change-Id: I3d5ad6c0623269492d775a99a947fd6fe26c5f91 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/71622 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sam McNally <sammc@google.com>
Diffstat (limited to 'internal.c')
-rw-r--r--internal.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/internal.c b/internal.c
index 0c23326a9..5d836e509 100644
--- a/internal.c
+++ b/internal.c
@@ -27,7 +27,7 @@
#include "hwaccess_x86_io.h"
#endif
-int is_laptop = 0;
+int g_is_laptop = 0;
bool g_laptop_ok = false;
bool force_boardmismatch = false;
@@ -108,12 +108,11 @@ static int get_params(const struct programmer_cfg *cfg,
return 0;
}
-// FIXME: remove '_' suffix from parameters once global shadowing is fixed.
-static void report_nonwl_laptop_detected(int is_laptop_, bool laptop_ok)
+static void report_nonwl_laptop_detected(int is_laptop, bool laptop_ok)
{
- if (is_laptop_ && !laptop_ok) {
+ if (is_laptop && !laptop_ok) {
msg_pinfo("========================================================================\n");
- if (is_laptop_ == 1) {
+ if (is_laptop == 1) {
msg_pinfo("You seem to be running flashrom on an unknown laptop. Some\n"
"internal buses have been disabled for safety reasons.\n\n");
} else {
@@ -204,9 +203,9 @@ static int internal_init(const struct programmer_cfg *cfg)
}
}
- is_laptop = 2; /* Assume that we don't know by default. */
+ g_is_laptop = 2; /* Assume that we don't know by default. */
- dmi_init();
+ dmi_init(&g_is_laptop);
/* In case Super I/O probing would cause pretty explosions. */
board_handle_before_superio(force_boardenable);
@@ -229,7 +228,7 @@ static int internal_init(const struct programmer_cfg *cfg)
* this isn't a laptop. Board-enables may override this,
* non-legacy buses (SPI and opaque atm) are probed anyway.
*/
- if (is_laptop && !(g_laptop_ok || force_laptop || (not_a_laptop && is_laptop == 2)))
+ if (g_is_laptop && !(g_laptop_ok || force_laptop || (not_a_laptop && g_is_laptop == 2)))
internal_buses_supported = BUS_NONE;
/* try to enable it. Failure IS an option, since not all motherboards
@@ -258,7 +257,7 @@ static int internal_init(const struct programmer_cfg *cfg)
internal_par_init(internal_buses_supported);
/* Report if a non-whitelisted laptop is detected that likely uses a legacy bus. */
- report_nonwl_laptop_detected(is_laptop, g_laptop_ok);
+ report_nonwl_laptop_detected(g_is_laptop, g_laptop_ok);
ret = 0;