Skip to content

Commit

Permalink
cpufreq: Do not allow ->setpolicy drivers to provide ->target
Browse files Browse the repository at this point in the history
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: Rafael J. Wysocki <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
  • Loading branch information
rafaeljw committed Mar 19, 2014
1 parent 8f3ba3d commit 9832235
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9832235

Please sign in to comment.