]> git.ipfire.org Git - thirdparty/linux.git/commit
platform/x86/amd/pmf: Refactor repetitive BIOS output handling
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Thu, 27 Nov 2025 09:10:38 +0000 (14:40 +0530)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 27 Nov 2025 09:37:21 +0000 (11:37 +0200)
commit278ff7048466349e32d85afd62a4fcaf398ac23e
treee5cb09ad7df31a39e2826f3447d612a7bcc931c5
parent5c14bff570dc5a756d90f7a5bc665cbbe604db8b
platform/x86/amd/pmf: Refactor repetitive BIOS output handling

Replace repetitive switch-case statements for PMF_POLICY_BIOS_OUTPUT_*
with a helper function and consolidated case handling. This reduces code
duplication and improves maintainability.

The 10 BIOS output policies (PMF_POLICY_BIOS_OUTPUT_1 through
PMF_POLICY_BIOS_OUTPUT_10) previously each had individual case statements
with identical logic. This patch introduces
amd_pmf_get_bios_output_idx() to map policy values to array indices,
consolidating the handling into a single case block with fallthrough.
Also, add a new function amd_pmf_update_bios_output() to simplify the code
handling.

This approach handles non-sequential policy enum values gracefully and
makes future additions easier to implement.

No functional changes.

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://patch.msgid.link/20251127091038.2088387-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmf/tee-if.c