[tip: x86/platform] firmware: dmi: Adjust dmi_decode() to use enums

From: tip-bot2 for Mario Limonciello (AMD)

Date: Wed Apr 01 2026 - 15:41:37 EST


The following commit has been merged into the x86/platform branch of tip:

Commit-ID: 28189e95712b70008754c993ecd3531d1c7018d1
Gitweb: https://git.kernel.org/tip/28189e95712b70008754c993ecd3531d1c7018d1
Author: Mario Limonciello (AMD) <superm1@xxxxxxxxxx>
AuthorDate: Sat, 07 Mar 2026 08:10:21 -06:00
Committer: Borislav Petkov (AMD) <bp@xxxxxxxxx>
CommitterDate: Wed, 01 Apr 2026 20:54:16 +02:00

firmware: dmi: Adjust dmi_decode() to use enums

dmi_decode() has hardcoded values with comments for each DMI entry type. The
same information is already in dmi.h though, so drop the comments and use the
definitions instead.

Signed-off-by: Mario Limonciello (AMD) <superm1@xxxxxxxxxx>
Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Reviewed-by: Jean Delvare <jdelvare@xxxxxxx>
Reviewed-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
Link: https://patch.msgid.link/20260307141024.819807-3-superm1@xxxxxxxxxx
---
drivers/firmware/dmi_scan.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 70d39ad..80aded4 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -484,14 +484,14 @@ static void __init dmi_memdev_walk(void)
static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
{
switch (dm->type) {
- case 0: /* BIOS Information */
+ case DMI_ENTRY_BIOS:
dmi_save_ident(dm, DMI_BIOS_VENDOR, 4);
dmi_save_ident(dm, DMI_BIOS_VERSION, 5);
dmi_save_ident(dm, DMI_BIOS_DATE, 8);
dmi_save_release(dm, DMI_BIOS_RELEASE, 21);
dmi_save_release(dm, DMI_EC_FIRMWARE_RELEASE, 23);
break;
- case 1: /* System Information */
+ case DMI_ENTRY_SYSTEM:
dmi_save_ident(dm, DMI_SYS_VENDOR, 4);
dmi_save_ident(dm, DMI_PRODUCT_NAME, 5);
dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
@@ -500,33 +500,33 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
dmi_save_ident(dm, DMI_PRODUCT_SKU, 25);
dmi_save_ident(dm, DMI_PRODUCT_FAMILY, 26);
break;
- case 2: /* Base Board Information */
+ case DMI_ENTRY_BASEBOARD:
dmi_save_ident(dm, DMI_BOARD_VENDOR, 4);
dmi_save_ident(dm, DMI_BOARD_NAME, 5);
dmi_save_ident(dm, DMI_BOARD_VERSION, 6);
dmi_save_ident(dm, DMI_BOARD_SERIAL, 7);
dmi_save_ident(dm, DMI_BOARD_ASSET_TAG, 8);
break;
- case 3: /* Chassis Information */
+ case DMI_ENTRY_CHASSIS:
dmi_save_ident(dm, DMI_CHASSIS_VENDOR, 4);
dmi_save_type(dm, DMI_CHASSIS_TYPE, 5);
dmi_save_ident(dm, DMI_CHASSIS_VERSION, 6);
dmi_save_ident(dm, DMI_CHASSIS_SERIAL, 7);
dmi_save_ident(dm, DMI_CHASSIS_ASSET_TAG, 8);
break;
- case 9: /* System Slots */
+ case DMI_ENTRY_SYSTEM_SLOT:
dmi_save_system_slot(dm);
break;
- case 10: /* Onboard Devices Information */
+ case DMI_ENTRY_ONBOARD_DEVICE:
dmi_save_devices(dm);
break;
- case 11: /* OEM Strings */
+ case DMI_ENTRY_OEMSTRINGS:
dmi_save_oem_strings_devices(dm);
break;
- case 38: /* IPMI Device Information */
+ case DMI_ENTRY_IPMI_DEV:
dmi_save_ipmi_device(dm);
break;
- case 41: /* Onboard Devices Extended Information */
+ case DMI_ENTRY_ONBOARD_DEV_EXT:
dmi_save_extended_devices(dm);
}
}