From f7995f721a66152a63b317386830593fda03f275 Mon Sep 17 00:00:00 2001 From: Finley Xiao Date: Fri, 27 May 2022 16:48:35 +0800 Subject: [PATCH] PM / devfreq: rockchip_dmc: Fix cpufreq_cpu_acquire/release undefined Fix build error when build as module. Fixes: a2328c4f992e ("PM / devfreq: rockchip_dmc: Get policy when need to increase cpu frequency") Signed-off-by: Finley Xiao Change-Id: I61ce3457355c10f91ce43ae6d1fb5b6dab0d424d --- drivers/devfreq/rockchip_dmc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/rockchip_dmc.c b/drivers/devfreq/rockchip_dmc.c index 35b546bc2441..47de7e52a16d 100644 --- a/drivers/devfreq/rockchip_dmc.c +++ b/drivers/devfreq/rockchip_dmc.c @@ -407,11 +407,12 @@ static int rockchip_dmcfreq_target(struct device *dev, unsigned long *freq, * set_rate needs to complete during vblank. */ cpu_cur = raw_smp_processor_id(); - policy = cpufreq_cpu_acquire(cpu_cur); + policy = cpufreq_cpu_get(cpu_cur); if (!policy) { dev_err(dev, "cpu%d policy NULL\n", cpu_cur); goto cpufreq; } + down_write(&policy->rwsem); cpufreq_cur = cpufreq_quick_get(cpu_cur); /* If we're thermally throttled; don't change; */ @@ -510,7 +511,8 @@ out: if (is_cpufreq_changed) __cpufreq_driver_target(policy, cpufreq_cur, CPUFREQ_RELATION_L); - cpufreq_cpu_release(policy); + up_write(&policy->rwsem); + cpufreq_cpu_put(policy); } cpufreq: cpus_read_unlock();