]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
firmware: dmi: Adjust dmi_decode() to use enums
authorMario Limonciello (AMD) <superm1@kernel.org>
Sat, 7 Mar 2026 14:10:21 +0000 (08:10 -0600)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 1 Apr 2026 18:54:16 +0000 (20:54 +0200)
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@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Link: https://patch.msgid.link/20260307141024.819807-3-superm1@kernel.org
drivers/firmware/dmi_scan.c

index 70d39adf50dcaaa7c99b48fe8e9045af5ea24d00..80aded4c778bcc2b6b3c922ced5f0b8498c2b333 100644 (file)
@@ -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);
        }
 }