Blame SOURCES/0004-dmidecode-Use-dmi_cache_size_2-in-dmi_cache_size.patch

abf46d
From 941591e24564e4c6d6584dbaa868976f9e80e925 Mon Sep 17 00:00:00 2001
abf46d
From: Jean Delvare <jdelvare@suse.de>
abf46d
Date: Tue, 15 Jan 2019 12:59:08 +0100
abf46d
Subject: [PATCH 4/5] dmidecode: Use dmi_cache_size_2 in dmi_cache_size
abf46d
abf46d
Redirect dmi_cache_size() to dmi_cache_size_2() so that the cache
abf46d
size is always reported using the most appropriate unit, even if the
abf46d
BIOS does not populate the 32-bit cache size fields.
abf46d
abf46d
Signed-off-by: Jean Delvare <jdelvare@suse.de>
abf46d
Acked-by: Neil Horman <nhorman@tuxdriver.com>
abf46d
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
abf46d
---
abf46d
 dmidecode.c | 13 +++++--------
abf46d
 1 file changed, 5 insertions(+), 8 deletions(-)
abf46d
abf46d
diff --git a/dmidecode.c b/dmidecode.c
abf46d
index 162e0c50ba26..903ef356ea9e 100644
abf46d
--- a/dmidecode.c
abf46d
+++ b/dmidecode.c
abf46d
@@ -1550,14 +1550,6 @@ static const char *dmi_cache_location(u8 code)
abf46d
 	return location[code];
abf46d
 }
abf46d
 
abf46d
-static void dmi_cache_size(u16 code)
abf46d
-{
abf46d
-	if (code & 0x8000)
abf46d
-		printf(" %u kB", (code & 0x7FFF) << 6);
abf46d
-	else
abf46d
-		printf(" %u kB", code);
abf46d
-}
abf46d
-
abf46d
 static void dmi_cache_size_2(u32 code)
abf46d
 {
abf46d
 	u64 size;
abf46d
@@ -1578,6 +1570,11 @@ static void dmi_cache_size_2(u32 code)
abf46d
 	dmi_print_memory_size(size, 1);
abf46d
 }
abf46d
 
abf46d
+static void dmi_cache_size(u16 code)
abf46d
+{
abf46d
+	dmi_cache_size_2((((u32)code & 0x8000LU) << 16) | (code & 0x7FFFLU));
abf46d
+}
abf46d
+
abf46d
 static void dmi_cache_types(u16 code, const char *sep)
abf46d
 {
abf46d
 	/* 7.8.2 */
abf46d
-- 
abf46d
2.17.1
abf46d