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>
#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>
}
}
+ /*
+ * 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);