cpufreq/amd-pstate: Fix the return value of amd_pstate_fast_switch()
authorGautham R. Shenoy <gautham.shenoy@amd.com>
Mon, 27 Nov 2023 11:11:21 +0000 (16:41 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Dec 2023 07:51:15 +0000 (08:51 +0100)
commit4da1556996fa510dcc7787e21f5f42491c369b19
tree7b22d3a84237ff19741acac5a01a6aed4d41d2d4
parent9d4c721c1866f92c79016e9c04bcae40740c27de
cpufreq/amd-pstate: Fix the return value of amd_pstate_fast_switch()

commit bb87be267b8ee9b40917fb5bf51be5ddb33c37c2 upstream.

cpufreq_driver->fast_switch() callback expects a frequency as a return
value. amd_pstate_fast_switch() was returning the return value of
amd_pstate_update_freq(), which only indicates a success or failure.

Fix this by making amd_pstate_fast_switch() return the target_freq
when the call to amd_pstate_update_freq() is successful, and return
the current frequency from policy->cur when the call to
amd_pstate_update_freq() is unsuccessful.

Fixes: 4badf2eb1e98 ("cpufreq: amd-pstate: Add ->fast_switch() callback")
Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Wyes Karny <wyes.karny@amd.com>
Reviewed-by: Perry Yuan <perry.yuan@amd.com>
Cc: 6.4+ <stable@vger.kernel.org> # v6.4+
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cpufreq/amd-pstate.c