From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
Huang Rui <ray.huang@amd.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: Mario Limonciello <superm1@kernel.org>,
Perry Yuan <perry.yuan@amd.com>,
"K Prateek Nayak" <kprateek.nayak@amd.com>,
<linux-pm@vger.kernel.org>, <linux-doc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH v2 7/9] cpufreq/amd-pstate: Reduce the scope of exported symbols
Date: Thu, 23 Jul 2026 20:12:26 +0000 [thread overview]
Message-ID: <20260723201228.22584-8-kprateek.nayak@amd.com> (raw)
In-Reply-To: <20260723201228.22584-1-kprateek.nayak@amd.com>
Symbols exported by amd-pstate.c are ever only needed for amd-pstate-ut.
Introduce EXPORT_SYMBOL_FOR_PSTATE_UT() to export these symbols
selectively to "amd-pstate-ut" namespace as opposed to all GPL modules.
No functional changes intended.
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
---
Changelog rfc v1..v2:
o Collected tag from Mario. (Thanks a ton!)
---
drivers/cpufreq/amd-pstate.c | 14 +++++++-------
drivers/cpufreq/amd-pstate.h | 7 +++++++
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 92da8937df04..b875e92103e1 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -75,7 +75,7 @@ const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode)
mode = AMD_PSTATE_UNDEFINED;
return amd_pstate_mode_string[mode];
}
-EXPORT_SYMBOL_GPL(amd_pstate_get_mode_string);
+EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_get_mode_string);
struct quirk_entry {
u32 nominal_freq;
@@ -1271,7 +1271,7 @@ void amd_pstate_clear_dynamic_epp(struct cpufreq_policy *policy)
kfree(cpudata->profile_name);
cpudata->dynamic_epp = false;
}
-EXPORT_SYMBOL_GPL(amd_pstate_clear_dynamic_epp);
+EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_clear_dynamic_epp);
static int amd_pstate_set_dynamic_epp(struct cpufreq_policy *policy)
{
@@ -1466,7 +1466,7 @@ ssize_t store_energy_performance_preference(struct cpufreq_policy *policy,
return count;
}
-EXPORT_SYMBOL_GPL(store_energy_performance_preference);
+EXPORT_SYMBOL_FOR_PSTATE_UT(store_energy_performance_preference);
ssize_t show_energy_performance_preference(struct cpufreq_policy *policy, char *buf)
{
@@ -1500,7 +1500,7 @@ ssize_t show_energy_performance_preference(struct cpufreq_policy *policy, char *
return sysfs_emit(buf, "%s\n", energy_perf_strings[preference]);
}
-EXPORT_SYMBOL_GPL(show_energy_performance_preference);
+EXPORT_SYMBOL_FOR_PSTATE_UT(show_energy_performance_preference);
static ssize_t store_amd_pstate_floor_freq(struct cpufreq_policy *policy,
const char *buf, size_t count)
@@ -1600,7 +1600,7 @@ struct freq_attr **amd_pstate_get_current_attrs(void)
return NULL;
return current_pstate_driver->attr;
}
-EXPORT_SYMBOL_GPL(amd_pstate_get_current_attrs);
+EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_get_current_attrs);
static struct freq_attr **get_freq_attrs(void)
{
@@ -1785,7 +1785,7 @@ int amd_pstate_get_status(void)
{
return cppc_state;
}
-EXPORT_SYMBOL_GPL(amd_pstate_get_status);
+EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_get_status);
int amd_pstate_update_status(const char *buf, size_t size)
{
@@ -1805,7 +1805,7 @@ int amd_pstate_update_status(const char *buf, size_t size)
return 0;
}
-EXPORT_SYMBOL_GPL(amd_pstate_update_status);
+EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_update_status);
static ssize_t status_show(struct device *dev,
struct device_attribute *attr, char *buf)
diff --git a/drivers/cpufreq/amd-pstate.h b/drivers/cpufreq/amd-pstate.h
index 23e8baa05849..edd697a5e29f 100644
--- a/drivers/cpufreq/amd-pstate.h
+++ b/drivers/cpufreq/amd-pstate.h
@@ -11,6 +11,13 @@
#include <linux/pm_qos.h>
#include <linux/platform_profile.h>
+#if IS_MODULE(CONFIG_X86_AMD_PSTATE_UT)
+#define EXPORT_SYMBOL_FOR_PSTATE_UT(symbol) \
+ EXPORT_SYMBOL_FOR_MODULES(symbol, "amd-pstate-ut")
+#else
+#define EXPORT_SYMBOL_FOR_PSTATE_UT(symbol)
+#endif
+
/*********************************************************************
* AMD P-state INTERFACE *
*********************************************************************/
--
2.34.1
next prev parent reply other threads:[~2026-07-23 20:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 20:12 [PATCH v2 0/9] cpufreq/amd-pstate: BIOS min perf fixes and Dynamic EPP rework K Prateek Nayak
2026-07-23 20:12 ` [PATCH v2 1/9] cpufreq/amd-pstate: Set min_limit_freq based on bios_min_perf K Prateek Nayak
2026-07-23 20:12 ` [PATCH v2 2/9] cpufreq/amd-pstate: Remove the defensive check for bios_min_perf K Prateek Nayak
2026-07-23 21:17 ` Mario Limonciello
2026-07-23 20:12 ` [PATCH v2 3/9] cpufreq/amd-pstate: Extract platform profile to EPP conversion into a helper K Prateek Nayak
2026-07-23 20:12 ` [PATCH v2 4/9] cpufreq/amd-pstate: Add dynamic EPP as an "energy_performance_preference" mode K Prateek Nayak
2026-07-23 20:12 ` [PATCH v2 5/9] cpufreq/amd-pstate: Remove "amd_dynamic_epp" cmdline and "dynamic_epp" sysfs K Prateek Nayak
2026-07-23 20:12 ` [PATCH v2 6/9] Documentation/amd-pstate: Update dynamic_epp documentation with new behavior K Prateek Nayak
2026-07-23 20:12 ` K Prateek Nayak [this message]
2026-07-23 20:12 ` [PATCH v2 8/9] cpufreq/amd-pstate-ut: Add unit test for "dynamic" EPP mode K Prateek Nayak
2026-07-23 20:12 ` [PATCH v2 9/9] cpufreq/amd-pstate-ut: Add unit test for CPPC Performance Priority K Prateek Nayak
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=20260723201228.22584-8-kprateek.nayak@amd.com \
--to=kprateek.nayak@amd.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=perry.yuan@amd.com \
--cc=rafael@kernel.org \
--cc=ray.huang@amd.com \
--cc=superm1@kernel.org \
--cc=viresh.kumar@linaro.org \
/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