diff options
author | Finley Xiao <finley.xiao@rock-chips.com> | 2017-05-15 09:42:29 +0800 |
---|---|---|
committer | Huang, Tao <huangtao@rock-chips.com> | 2017-05-17 11:45:40 +0800 |
commit | 08e0c3fbe7cda3e0601ea730b102874e05114823 (patch) | |
tree | 33101d4c99f49730631aa3f08f183eb28ab2eef9 | |
parent | f7770d6f9f8d0e7afc578e6d22cea62d834c0d78 (diff) |
PM / devfreq: Lock CPU online/offline in rockchip_dmcfreq_target()
To protect against races with concurrent CPU online/offline, call
get_online_cpus() before change frequency.
Change-Id: I5b97cd7eff6a1c4828ab30bc165fb2aa8b460bb3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
-rw-r--r-- | drivers/devfreq/rockchip_dmc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/devfreq/rockchip_dmc.c b/drivers/devfreq/rockchip_dmc.c index 4cf6a1999248..81a2f2c89897 100644 --- a/drivers/devfreq/rockchip_dmc.c +++ b/drivers/devfreq/rockchip_dmc.c @@ -17,6 +17,7 @@ #include <drm/drmP.h> #include <linux/arm-smccc.h> #include <linux/clk.h> +#include <linux/cpu.h> #include <linux/delay.h> #include <linux/devfreq.h> #include <linux/devfreq-event.h> @@ -217,7 +218,16 @@ static int rockchip_dmcfreq_target(struct device *dev, unsigned long *freq, } } + /* + * We need to prevent cpu hotplug from happening while a dmc freq rate + * change is happening. + */ + get_online_cpus(); + err = clk_set_rate(dmcfreq->dmc_clk, target_rate); + + put_online_cpus(); + if (err) { dev_err(dev, "Cannot set frequency %lu (%d)\n", target_rate, err); |