Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/59283 )
Change subject: dmi.c: Hide has_dmi_support global behind method ......................................................................
dmi.c: Hide has_dmi_support global behind method
This allows has_dmi_support to be become static local to just the scope of dmi.c
BUG=none TEST=builds
Change-Id: Ibded9714998ea6f2e5d4e0512fa7c6b105f9638a Signed-off-by: Edward O'Callaghan quasisec@google.com --- M board_enable.c M dmi.c M programmer.h 3 files changed, 10 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/83/59283/1
diff --git a/board_enable.c b/board_enable.c index a3a8b01..0141d1c 100644 --- a/board_enable.c +++ b/board_enable.c @@ -2656,7 +2656,7 @@
#if defined(__i386__) || defined(__x86_64__) if (board->dmi_pattern) { - if (!has_dmi_support) { + if (!has_dmi_support()) { msg_pwarn("Warning: Can't autodetect %s %s, DMI info unavailable.\n", board->vendor_name, board->board_name); msg_pinfo("Please supply the board vendor and model name with the " diff --git a/dmi.c b/dmi.c index d2e149d..8bce800 100644 --- a/dmi.c +++ b/dmi.c @@ -40,7 +40,12 @@ /* Strings longer than 4096 in DMI are just insane. */ #define DMI_MAX_ANSWER_LEN 4096
-int has_dmi_support = 0; +static int g_has_dmi_support = 0; + +int has_dmi_support(void) +{ + return g_has_dmi_support; +}
static struct { const char *const keyword; @@ -405,7 +410,7 @@ break; }
- has_dmi_support = 1; + g_has_dmi_support = 1; unsigned int i; for (i = 0; i < ARRAY_SIZE(dmi_strings); i++) { msg_pdbg("DMI string %s: "%s"\n", dmi_strings[i].keyword, @@ -465,7 +470,7 @@ { unsigned int i;
- if (!has_dmi_support) + if (!g_has_dmi_support) return 0;
for (i = 0; i < ARRAY_SIZE(dmi_strings); i++) { diff --git a/programmer.h b/programmer.h index ffd2516..1f64d5a 100644 --- a/programmer.h +++ b/programmer.h @@ -254,7 +254,7 @@
/* dmi.c */ #if defined(__i386__) || defined(__x86_64__) -extern int has_dmi_support; +int has_dmi_support(void); void dmi_init(void); int dmi_match(const char *pattern); #endif // defined(__i386__) || defined(__x86_64__)