]> www.infradead.org Git - users/griffoul/linux.git/commitdiff
cpufreq/amd-pstate: Remove the switch case in amd_pstate_init()
authorDhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Thu, 17 Oct 2024 10:05:31 +0000 (10:05 +0000)
committerMario Limonciello <mario.limonciello@amd.com>
Mon, 28 Oct 2024 19:54:35 +0000 (14:54 -0500)
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>
drivers/cpufreq/amd-pstate.c

index 5155fc0019dfdf8560b7f78f8c60b8c6b381d98e..13ee5cac901d4ce603a179a28066a1c85780aab8 100644 (file)
@@ -1843,21 +1843,15 @@ static int __init amd_pstate_init(void)
                cppc_state = CONFIG_X86_AMD_PSTATE_DEFAULT_MODE;
        }
 
-       switch (cppc_state) {
-       case AMD_PSTATE_DISABLE:
+       if (cppc_state == AMD_PSTATE_DISABLE) {
                pr_info("driver load is disabled, boot with specific mode to enable this\n");
                return -ENODEV;
-       case AMD_PSTATE_PASSIVE:
-       case AMD_PSTATE_ACTIVE:
-       case AMD_PSTATE_GUIDED:
-               ret = amd_pstate_set_driver(cppc_state);
-               if (ret)
-                       return ret;
-               break;
-       default:
-               return -EINVAL;
        }
 
+       ret = amd_pstate_set_driver(cppc_state);
+       if (ret)
+               return ret;
+
        /* capability check */
        if (cpu_feature_enabled(X86_FEATURE_CPPC)) {
                pr_debug("AMD CPPC MSR based functionality is supported\n");