Commit 9832235f authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

cpufreq: Do not allow ->setpolicy drivers to provide ->target

cpufreq drivers that provide the ->setpolicy() callback are supposed
to have integrated governors, so they don't need to set ->target()
or ->target_index() and may confuse the core if any of these callbacks
is present.

For this reason, add a check preventing ->setpolicy cpufreq drivers
from registering if they have non-NULL ->target or ->target_index.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 8f3ba3d3
......@@ -2299,7 +2299,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
if (!driver_data || !driver_data->verify || !driver_data->init ||
!(driver_data->setpolicy || driver_data->target_index ||
driver_data->target))
driver_data->target) ||
(driver_data->setpolicy && (driver_data->target_index ||
driver_data->target)))
return -EINVAL;
pr_debug("trying to register driver %s\n", driver_data->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment