Skip to content

Commit 162cfa4

Browse files
dhananjay-AMDsuperm1
authored andcommitted
cpufreq/amd-pstate: Remove the switch case in amd_pstate_init()
Replace the switch case with a more readable if condition. Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20241017100528.300143-4-Dhananjay.Ugwekar@amd.com Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
1 parent e3591ee commit 162cfa4

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

drivers/cpufreq/amd-pstate.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,21 +1843,15 @@ static int __init amd_pstate_init(void)
18431843
cppc_state = CONFIG_X86_AMD_PSTATE_DEFAULT_MODE;
18441844
}
18451845

1846-
switch (cppc_state) {
1847-
case AMD_PSTATE_DISABLE:
1846+
if (cppc_state == AMD_PSTATE_DISABLE) {
18481847
pr_info("driver load is disabled, boot with specific mode to enable this\n");
18491848
return -ENODEV;
1850-
case AMD_PSTATE_PASSIVE:
1851-
case AMD_PSTATE_ACTIVE:
1852-
case AMD_PSTATE_GUIDED:
1853-
ret = amd_pstate_set_driver(cppc_state);
1854-
if (ret)
1855-
return ret;
1856-
break;
1857-
default:
1858-
return -EINVAL;
18591849
}
18601850

1851+
ret = amd_pstate_set_driver(cppc_state);
1852+
if (ret)
1853+
return ret;
1854+
18611855
/* capability check */
18621856
if (cpu_feature_enabled(X86_FEATURE_CPPC)) {
18631857
pr_debug("AMD CPPC MSR based functionality is supported\n");

0 commit comments

Comments
 (0)