[PATCH 3/5] platform/x86/amd/pmf: Inline simple helper function of SPS Layer

From: Rong Zhang

Date: Tue Sep 01 2026 - 13:09:14 EST


The SPS Layer has a simple and dumb helper function defined as a global
symbol, which is heavily 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 252 Bytes
(GCC 16 -O2):

text data bss total filename (before)
26533 31452 2768 60753 amd-pmf.ko

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

There are also two duplicated prototypes, so remove one of them as well.

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

diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h
index 024f20306e11..4a4c3aeadecc 100644
--- a/drivers/platform/x86/amd/pmf/pmf.h
+++ b/drivers/platform/x86/amd/pmf/pmf.h
@@ -1126,12 +1126,9 @@ void amd_pmf_update_slider(struct amd_pmf_dev *dev, bool op, int idx,
int amd_pmf_init_sps(struct amd_pmf_dev *dev);
int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev,
struct apmf_static_slider_granular_output *output);
-bool is_pprof_balanced(struct amd_pmf_dev *pmf);
int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev);
const char *amd_pmf_source_as_str(unsigned int state);

-const char *amd_pmf_source_as_str(unsigned int state);
-
int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx);
int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *pmf);
int apmf_get_static_slider_granular_v2(struct amd_pmf_dev *dev,
@@ -1139,6 +1136,11 @@ int apmf_get_static_slider_granular_v2(struct amd_pmf_dev *dev,
int apts_get_static_slider_granular_v2(struct amd_pmf_dev *pdev,
struct amd_pmf_apts_granular_output *data, u32 apts_idx);

+static inline bool is_pprof_balanced(struct amd_pmf_dev *pmf)
+{
+ return pmf->current_profile == PLATFORM_PROFILE_BALANCED;
+}
+
/* Auto Mode Layer */
int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct apmf_auto_mode *data);
void amd_pmf_init_auto_mode(struct amd_pmf_dev *dev);
diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c
index 0b70a5153f46..035272d37867 100644
--- a/drivers/platform/x86/amd/pmf/sps.c
+++ b/drivers/platform/x86/amd/pmf/sps.c
@@ -281,11 +281,6 @@ int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *pmf)
return 0;
}

-bool is_pprof_balanced(struct amd_pmf_dev *pmf)
-{
- return pmf->current_profile == PLATFORM_PROFILE_BALANCED;
-}
-
static int amd_pmf_profile_get(struct device *dev,
enum platform_profile_option *profile)
{

--
2.55.0