MLK-20104 driver: cpufreq: remove unnecessary mutex & rcu lock
Remove the unnecessary mutex and rcu lock from i.MX8MQ & i.MX7ULP cpufreq driver. Signed-off-by: Bai Ping <ping.bai@nxp.com> Reviewed-by: Anson Huang <Anson.Huang@nxp.com>pull/10/head
parent
7f3671ddd7
commit
c54dc3d1a7
|
@ -36,7 +36,6 @@ static struct regulator *arm_reg;
|
|||
static struct device *cpu_dev;
|
||||
static struct cpufreq_frequency_table *freq_table;
|
||||
static unsigned int transition_latency;
|
||||
static struct mutex set_cpufreq_lock;
|
||||
|
||||
static int imx7ulp_set_target(struct cpufreq_policy *policy, unsigned int index)
|
||||
{
|
||||
|
@ -45,23 +44,18 @@ static int imx7ulp_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
unsigned int old_freq, new_freq;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&set_cpufreq_lock);
|
||||
|
||||
new_freq = freq_table[index].frequency;
|
||||
freq_hz = new_freq * 1000;
|
||||
old_freq = clk_get_rate(arm_clk) / 1000;
|
||||
|
||||
rcu_read_lock();
|
||||
opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz);
|
||||
if (IS_ERR(opp)) {
|
||||
rcu_read_unlock();
|
||||
dev_err(cpu_dev, "failed to find OPP for %ld\n", freq_hz);
|
||||
mutex_unlock(&set_cpufreq_lock);
|
||||
return PTR_ERR(opp);
|
||||
}
|
||||
volt = dev_pm_opp_get_voltage(opp);
|
||||
dev_pm_opp_put(opp);
|
||||
|
||||
rcu_read_unlock();
|
||||
volt_old = regulator_get_voltage(arm_reg);
|
||||
|
||||
dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n",
|
||||
|
@ -73,7 +67,6 @@ static int imx7ulp_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
ret = regulator_set_voltage_tol(arm_reg, volt, 0);
|
||||
if (ret) {
|
||||
dev_err(cpu_dev, "failed to scale vddarm up: %d\n", ret);
|
||||
mutex_unlock(&set_cpufreq_lock);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +104,6 @@ static int imx7ulp_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&set_cpufreq_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -202,7 +194,6 @@ static int imx7ulp_cpufreq_probe(struct platform_device *pdev)
|
|||
if (of_property_read_u32(np, "clock-latency", &transition_latency))
|
||||
transition_latency = CPUFREQ_ETERNAL;
|
||||
|
||||
mutex_init(&set_cpufreq_lock);
|
||||
ret = cpufreq_register_driver(&imx7ulp_cpufreq_driver);
|
||||
if (ret) {
|
||||
dev_err(cpu_dev, "failed to register driver\n");
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
static struct device *cpu_dev;
|
||||
static bool free_opp;
|
||||
static struct cpufreq_frequency_table *freq_table;
|
||||
static struct mutex set_cpufreq_lock;
|
||||
static unsigned int transition_latency;
|
||||
static struct clk *a53_clk;
|
||||
static struct clk *arm_a53_src_clk;
|
||||
|
@ -43,22 +42,17 @@ static int imx8mq_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
unsigned int old_freq, new_freq;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&set_cpufreq_lock);
|
||||
|
||||
new_freq = freq_table[index].frequency;
|
||||
freq_hz = new_freq * 1000;
|
||||
old_freq = policy->cur;
|
||||
|
||||
rcu_read_lock();
|
||||
opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz);
|
||||
if (IS_ERR(opp)) {
|
||||
rcu_read_unlock();
|
||||
dev_err(cpu_dev, "failed to find OPP for %ld\n", freq_hz);
|
||||
mutex_unlock(&set_cpufreq_lock);
|
||||
return PTR_ERR(opp);
|
||||
}
|
||||
volt = dev_pm_opp_get_voltage(opp);
|
||||
rcu_read_unlock();
|
||||
dev_pm_opp_put(opp);
|
||||
|
||||
dev_dbg(cpu_dev, "%u MHz --> %u MHz\n",
|
||||
old_freq / 1000, new_freq / 1000);
|
||||
|
@ -68,7 +62,6 @@ static int imx8mq_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
ret = regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MAX, 0);
|
||||
if (ret) {
|
||||
dev_err(cpu_dev, "failed to scale dc_reg up: %d\n", ret);
|
||||
mutex_unlock(&set_cpufreq_lock);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +72,6 @@ static int imx8mq_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
ret = regulator_set_voltage_tol(arm_reg, volt, 0);
|
||||
if (ret) {
|
||||
dev_err(cpu_dev, "failed to scale arm_reg up: %d\n", ret);
|
||||
mutex_unlock(&set_cpufreq_lock);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +86,6 @@ static int imx8mq_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
ret = regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MIN, 0);
|
||||
if (ret) {
|
||||
dev_err(cpu_dev, "failed to scale dc_reg down: %d\n", ret);
|
||||
mutex_unlock(&set_cpufreq_lock);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +96,6 @@ static int imx8mq_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
ret = regulator_set_voltage_tol(arm_reg, volt, 0);
|
||||
if (ret) {
|
||||
dev_err(cpu_dev, "failed to scale arm_reg down: %d\n", ret);
|
||||
mutex_unlock(&set_cpufreq_lock);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +106,6 @@ static int imx8mq_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
if (ret)
|
||||
dev_err(cpu_dev, "failed to set clock rate: %d\n", ret);
|
||||
|
||||
mutex_unlock(&set_cpufreq_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -226,8 +215,6 @@ static int imx8mq_cpufreq_probe(struct platform_device *pdev)
|
|||
if (of_property_read_u32(np, "clock-latency", &transition_latency))
|
||||
transition_latency = CPUFREQ_ETERNAL;
|
||||
|
||||
mutex_init(&set_cpufreq_lock);
|
||||
|
||||
ret = cpufreq_register_driver(&imx8mq_cpufreq_driver);
|
||||
if (ret) {
|
||||
dev_err(cpu_dev, "failed register driver: %d\n", ret);
|
||||
|
|
Loading…
Reference in New Issue