summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2021-11-13 23:53:14 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2022-04-05 22:39:17 +0000
commitc706e6b52c3523dd71d5a67d8c0db62a74ae9941 (patch)
treed98b1f0841f683259779b4fa60c8f342ead650aa
parent170ad8991eaf7ed5f96eb72d0930635c9b664c0c (diff)
downloadflashrom-c706e6b52c3523dd71d5a67d8c0db62a74ae9941.tar.gz
flashrom-c706e6b52c3523dd71d5a67d8c0db62a74ae9941.tar.bz2
flashrom-c706e6b52c3523dd71d5a67d8c0db62a74ae9941.zip
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> Reviewed-on: https://review.coreboot.org/c/flashrom/+/59283 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-by: Sam McNally <sammc@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Thomas Heijligen <src@posteo.de>
-rw-r--r--board_enable.c2
-rw-r--r--dmi.c11
-rw-r--r--programmer.h2
3 files changed, 10 insertions, 5 deletions
diff --git a/board_enable.c b/board_enable.c
index 442db3315..9e4ab93c5 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -2666,7 +2666,7 @@ static const struct board_match *board_match_pci_ids(enum board_match_phase phas
#if defined(__i386__) || defined(__x86_64__)
if (board->dmi_pattern) {
- if (!has_dmi_support) {
+ if (!dmi_is_supported()) {
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 a7b300dad..a82b49463 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 bool g_has_dmi_support = false;
+
+bool dmi_is_supported(void)
+{
+ return g_has_dmi_support;
+}
static struct {
const char *const keyword;
@@ -405,7 +410,7 @@ void dmi_init(void)
break;
}
- has_dmi_support = 1;
+ g_has_dmi_support = true;
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 @@ int dmi_match(const char *pattern)
{
unsigned int i;
- if (!has_dmi_support)
+ if (!dmi_is_supported())
return 0;
for (i = 0; i < ARRAY_SIZE(dmi_strings); i++) {
diff --git a/programmer.h b/programmer.h
index 33cbcc794..0657bb1cf 100644
--- a/programmer.h
+++ b/programmer.h
@@ -245,8 +245,8 @@ int cb_check_image(const uint8_t *bios, unsigned int size);
/* dmi.c */
#if defined(__i386__) || defined(__x86_64__)
-extern int has_dmi_support;
void dmi_init(void);
+bool dmi_is_supported(void);
int dmi_match(const char *pattern);
#endif // defined(__i386__) || defined(__x86_64__)