]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86/amd/pmf: Add BIOS_INPUTS_MAX macro to replace hardcoded array size
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Wed, 19 Nov 2025 08:58:11 +0000 (14:28 +0530)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 27 Nov 2025 11:58:27 +0000 (13:58 +0200)
Define a new macro BIOS_INPUTS_MAX, to represent the maximum number of
BIOS input values. Replace hardcoded array sizes in relevant structures
with this macro to improve readability and maintainability.

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Tested-by: Yijun Shen <Yijun.Shen@Dell.com>
Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://patch.msgid.link/20251119085813.546813-1-Shyam-sundar.S-k@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmf/pmf.h

index f07e9f4c660a80ebc815c9fc2b6c93627a57dee5..9144c8c3bbaf2f6d2f8cb18600538a52b9235dd6 100644 (file)
@@ -119,6 +119,7 @@ struct cookie_header {
 
 #define APTS_MAX_STATES                16
 #define CUSTOM_BIOS_INPUT_BITS GENMASK(16, 7)
+#define BIOS_INPUTS_MAX                10
 
 /* amd_pmf_send_cmd() set/get */
 #define SET_CMD                false
@@ -210,7 +211,7 @@ struct apmf_sbios_req_v1 {
        u8 skin_temp_apu;
        u8 skin_temp_hs2;
        u8 enable_cnqf;
-       u32 custom_policy[10];
+       u32 custom_policy[BIOS_INPUTS_MAX];
 } __packed;
 
 struct apmf_sbios_req_v2 {
@@ -222,7 +223,7 @@ struct apmf_sbios_req_v2 {
        u32 stt_min_limit;
        u8 skin_temp_apu;
        u8 skin_temp_hs2;
-       u32 custom_policy[10];
+       u32 custom_policy[BIOS_INPUTS_MAX];
 } __packed;
 
 struct apmf_fan_idx {
@@ -361,7 +362,7 @@ enum power_modes_v2 {
 };
 
 struct pmf_bios_inputs_prev {
-       u32 custom_bios_inputs[10];
+       u32 custom_bios_inputs[BIOS_INPUTS_MAX];
 };
 
 struct amd_pmf_dev {
@@ -457,7 +458,7 @@ struct os_power_slider {
 struct amd_pmf_notify_smart_pc_update {
        u16 size;
        u32 pending_req;
-       u32 custom_bios[10];
+       u32 custom_bios[BIOS_INPUTS_MAX];
 } __packed;
 
 struct fan_table_control {