cpufreq: handle cpufreq being disabled for all exported function.
When disable_cpufreq() is called some exported functions are still being used that do not have a check for cpufreq being disabled. Add a disabled check into cpufreq_cpu_get() to return NULL if cpufreq is disabled this covers most of the exported functions. For the exported functions that do not call cpufreq_cpu_get() add an explicit check. Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
b8eed8af94
commit
d5aaffa9dd
@ -183,6 +183,9 @@ err_out:
|
|||||||
|
|
||||||
struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
|
struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
|
||||||
{
|
{
|
||||||
|
if (cpufreq_disabled())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return __cpufreq_cpu_get(cpu, false);
|
return __cpufreq_cpu_get(cpu, false);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(cpufreq_cpu_get);
|
EXPORT_SYMBOL_GPL(cpufreq_cpu_get);
|
||||||
@ -201,6 +204,9 @@ static void __cpufreq_cpu_put(struct cpufreq_policy *data, bool sysfs)
|
|||||||
|
|
||||||
void cpufreq_cpu_put(struct cpufreq_policy *data)
|
void cpufreq_cpu_put(struct cpufreq_policy *data)
|
||||||
{
|
{
|
||||||
|
if (cpufreq_disabled())
|
||||||
|
return;
|
||||||
|
|
||||||
__cpufreq_cpu_put(data, false);
|
__cpufreq_cpu_put(data, false);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(cpufreq_cpu_put);
|
EXPORT_SYMBOL_GPL(cpufreq_cpu_put);
|
||||||
@ -267,6 +273,9 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
|
|||||||
|
|
||||||
BUG_ON(irqs_disabled());
|
BUG_ON(irqs_disabled());
|
||||||
|
|
||||||
|
if (cpufreq_disabled())
|
||||||
|
return;
|
||||||
|
|
||||||
freqs->flags = cpufreq_driver->flags;
|
freqs->flags = cpufreq_driver->flags;
|
||||||
pr_debug("notification %u of frequency transition to %u kHz\n",
|
pr_debug("notification %u of frequency transition to %u kHz\n",
|
||||||
state, freqs->new);
|
state, freqs->new);
|
||||||
@ -1408,6 +1417,9 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (cpufreq_disabled())
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
WARN_ON(!init_cpufreq_transition_notifier_list_called);
|
WARN_ON(!init_cpufreq_transition_notifier_list_called);
|
||||||
|
|
||||||
switch (list) {
|
switch (list) {
|
||||||
@ -1442,6 +1454,9 @@ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (cpufreq_disabled())
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
switch (list) {
|
switch (list) {
|
||||||
case CPUFREQ_TRANSITION_NOTIFIER:
|
case CPUFREQ_TRANSITION_NOTIFIER:
|
||||||
ret = srcu_notifier_chain_unregister(
|
ret = srcu_notifier_chain_unregister(
|
||||||
@ -1522,6 +1537,9 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if (cpufreq_disabled())
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (!(cpu_online(cpu) && cpufreq_driver->getavg))
|
if (!(cpu_online(cpu) && cpufreq_driver->getavg))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user