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 <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mario Limonciello <[email protected]>
1 parent e3591ee commit 162cfa4

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

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)