From c706e6b52c3523dd71d5a67d8c0db62a74ae9941 Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Sat, 13 Nov 2021 23:53:14 +1100 Subject: 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/59283 Tested-by: build bot (Jenkins) Reviewed-by: Nikolai Artemiev Reviewed-by: Sam McNally Reviewed-by: Angel Pons Reviewed-by: Thomas Heijligen --- dmi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'dmi.c') diff --git a/dmi.c b/dmi.c index a7b300da..a82b4946 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++) { -- cgit v1.2.3