public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: Yazen Ghannam <yazen.ghannam@amd.com>, Jean Delvare <jdelvare@suse.com>
Cc: linux-kernel@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
	"Mario Limonciello (AMD)" <superm1@kernel.org>,
	Jean Delvare <jdelvare@suse.de>
Subject: [PATCH v6 2/5] firmware: dmi: Adjust dmi_decode() to use enums
Date: Sat,  7 Mar 2026 08:10:21 -0600	[thread overview]
Message-ID: <20260307141024.819807-3-superm1@kernel.org> (raw)
In-Reply-To: <20260307141024.819807-1-superm1@kernel.org>

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.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
v3:
 * pick up tag (Jean)
---
 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 70d39adf50dca..80aded4c778bc 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);
 	}
 }
-- 
2.43.0


  parent reply	other threads:[~2026-03-07 14:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-07 14:10 [PATCH v6 0/5] Print AGESA version at bootup Mario Limonciello (AMD)
2026-03-07 14:10 ` [PATCH v6 1/5] firmware: dmi: Correct an indexing error in dmi.h Mario Limonciello (AMD)
2026-04-01 19:34   ` [tip: x86/platform] " tip-bot2 for Mario Limonciello (AMD)
2026-03-07 14:10 ` Mario Limonciello (AMD) [this message]
2026-04-01 19:34   ` [tip: x86/platform] firmware: dmi: Adjust dmi_decode() to use enums tip-bot2 for Mario Limonciello (AMD)
2026-03-07 14:10 ` [PATCH v6 3/5] firmware: dmi: Add missing DMI entry types Mario Limonciello (AMD)
2026-04-01 11:03   ` Borislav Petkov
2026-04-01 13:16     ` Mario Limonciello (AMD)
2026-04-01 18:49       ` Borislav Petkov
2026-03-07 14:10 ` [PATCH v6 4/5] firmware: dmi: Add pr_fmt() for dmi_scan.c Mario Limonciello (AMD)
2026-04-01 19:34   ` [tip: x86/platform] " tip-bot2 for Mario Limonciello (AMD)
2026-03-07 14:10 ` [PATCH v6 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry Mario Limonciello (AMD)
2026-04-01  9:17   ` Jean Delvare
2026-04-01 10:29     ` Borislav Petkov
2026-04-01 11:45       ` Borislav Petkov
2026-04-01 13:14         ` Mario Limonciello (AMD)
2026-04-01 18:52           ` Borislav Petkov
2026-04-01 19:34   ` [tip: x86/platform] " tip-bot2 for Yazen Ghannam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260307141024.819807-3-superm1@kernel.org \
    --to=superm1@kernel.org \
    --cc=bp@alien8.de \
    --cc=jdelvare@suse.com \
    --cc=jdelvare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox