Skip to content

Commit

Permalink
cpufreq: amd-pstate-ut: Remove module parameter access
Browse files Browse the repository at this point in the history
In amd-pstate-ut, shared memory-based systems call
get_shared_mem() as part of amd_pstate_ut_check_enabled()
function. This function was written when CONFIG_X86_AMD_PSTATE
was tristate config and amd_pstate can be built as a module.

Currently CONFIG_X86_AMD_PSTATE is a boolean config and module
parameter shared_mem is removed. But amd-pstate-ut code still
accesses this module parameter. Remove those accesses.

Fixes: 456ca88 ("cpufreq: amd-pstate: change amd-pstate driver to be built-in type")
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Meng Li <li.meng@amd.com>
Reviewed-by: Wyes Karny <wyes.karny@amd.com>
Suggested-by: Wyes Karny <wyes.karny@amd.com>
Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
[ rjw: Subject edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
SSapkal authored and rafaeljw committed Aug 22, 2023
1 parent a436ae9 commit 8d6e5e8
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions drivers/cpufreq/amd-pstate-ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,9 @@ static struct amd_pstate_ut_struct amd_pstate_ut_cases[] = {
static bool get_shared_mem(void)
{
bool result = false;
char path[] = "/sys/module/amd_pstate/parameters/shared_mem";
char buf[5] = {0};
struct file *filp = NULL;
loff_t pos = 0;
ssize_t ret;

if (!boot_cpu_has(X86_FEATURE_CPPC)) {
filp = filp_open(path, O_RDONLY, 0);
if (IS_ERR(filp))
pr_err("%s unable to open %s file!\n", __func__, path);
else {
ret = kernel_read(filp, &buf, sizeof(buf), &pos);
if (ret < 0)
pr_err("%s read %s file fail ret=%ld!\n",
__func__, path, (long)ret);
filp_close(filp, NULL);
}

if ('Y' == *buf)
result = true;
}
if (!boot_cpu_has(X86_FEATURE_CPPC))
result = true;

return result;
}
Expand Down

0 comments on commit 8d6e5e8

Please sign in to comment.