From: Finley Xiao Date: Mon, 15 May 2017 01:42:29 +0000 (+0800) Subject: PM / devfreq: Lock CPU online/offline in rockchip_dmcfreq_target() X-Git-Tag: release-20171130_firefly~4^2~559 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=08e0c3fbe7cda3e0601ea730b102874e05114823;p=firefly-linux-kernel-4.4.55.git 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 --- 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 #include #include +#include #include #include #include @@ -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);