[PATCH 4/5] platform/x86/amd/pmf: Inline simple helper function of Smart PC TA interfaces

From: Rong Zhang

Date: Tue Sep 01 2026 - 11:16:37 EST


The Smart PC TA interfaces have a simple and dumb helper function
defined as a global symbol, which is used by other layers and becomes a
symbol against linkage. This bloats the size of the module.

Convert it into a static inline function to get rid of the overhead of
function outlining and linkage, and shrink the module
(!CONFIG_AMD_PMF_DEBUG && CONFIG_AMD_PMF_UTIL_SUPPORT) size by 208 Bytes
(GCC 16 -O2):

text data bss total filename (before)
26341 31392 2768 60501 amd-pmf.ko

text data bss total filename (after)
26261 31264 2768 60293 amd-pmf.ko

Signed-off-by: Rong Zhang <i@xxxxxxxx>
---
drivers/platform/x86/amd/pmf/pmf.h | 13 ++++++++++++-
drivers/platform/x86/amd/pmf/spc.c | 13 -------------
2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h
index 4a4c3aeadecc..6d9963677a46 100644
--- a/drivers/platform/x86/amd/pmf/pmf.h
+++ b/drivers/platform/x86/amd/pmf/pmf.h
@@ -1171,7 +1171,18 @@ int amd_pmf_smartpc_apply_bios_output(struct amd_pmf_dev *dev, u32 val, u32 preq
/* Smart PC - TA interfaces */
void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev);
-u32 amd_pmf_get_ta_custom_bios_inputs(struct ta_pmf_enact_table *in, int index);
+
+static inline u32 amd_pmf_get_ta_custom_bios_inputs(struct ta_pmf_enact_table *in, int index)
+{
+ switch (index) {
+ case 0 ... 1:
+ return in->ev_info.bios_input_1[index];
+ case 2 ... 9:
+ return in->ev_info.bios_input_2[index - 2];
+ default:
+ return 0;
+ }
+}

#ifdef CONFIG_AMD_PMF_DEBUG
void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
diff --git a/drivers/platform/x86/amd/pmf/spc.c b/drivers/platform/x86/amd/pmf/spc.c
index ea11d29633c8..c939c5379151 100644
--- a/drivers/platform/x86/amd/pmf/spc.c
+++ b/drivers/platform/x86/amd/pmf/spc.c
@@ -17,19 +17,6 @@
#include <linux/units.h>
#include "pmf.h"

-u32 amd_pmf_get_ta_custom_bios_inputs(struct ta_pmf_enact_table *in, int index)
-{
- switch (index) {
- case 0 ... 1:
- return in->ev_info.bios_input_1[index];
- case 2 ... 9:
- return in->ev_info.bios_input_2[index - 2];
- default:
- return 0;
- }
-}
-EXPORT_SYMBOL(amd_pmf_get_ta_custom_bios_inputs);
-
#ifdef CONFIG_AMD_PMF_DEBUG
void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in)
{

--
2.55.0