]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq/amd-pstate: Remove the redundant amd_pstate_set_driver() call
authorDhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Thu, 17 Oct 2024 10:05:33 +0000 (10:05 +0000)
committerMario Limonciello <mario.limonciello@amd.com>
Mon, 28 Oct 2024 19:54:35 +0000 (14:54 -0500)
amd_pstate_set_driver() is called twice, once in amd_pstate_init() and once
as part of amd_pstate_register_driver(). Move around code and eliminate
the redundancy.

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-5-Dhananjay.Ugwekar@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
drivers/cpufreq/amd-pstate.c

index 13ee5cac901d4ce603a179a28066a1c85780aab8..6f6d961879ccf0efc46af600444454367c9eb4f4 100644 (file)
@@ -1848,9 +1848,11 @@ static int __init amd_pstate_init(void)
                return -ENODEV;
        }
 
-       ret = amd_pstate_set_driver(cppc_state);
-       if (ret)
+       ret = amd_pstate_register_driver(cppc_state);
+       if (ret) {
+               pr_err("failed to register with return %d\n", ret);
                return ret;
+       }
 
        /* capability check */
        if (cpu_feature_enabled(X86_FEATURE_CPPC)) {
@@ -1870,12 +1872,6 @@ static int __init amd_pstate_init(void)
                        return ret;
        }
 
-       ret = amd_pstate_register_driver(cppc_state);
-       if (ret) {
-               pr_err("failed to register with return %d\n", ret);
-               return ret;
-       }
-
        dev_root = bus_get_dev_root(&cpu_subsys);
        if (dev_root) {
                ret = sysfs_create_group(&dev_root->kobj, &amd_pstate_global_attr_group);