static void cpufreq_policy_free(struct cpufreq_policy *policy)
{
- unsigned long flags;
-
- write_lock_irqsave(&cpufreq_driver_lock, flags);
- list_del(&policy->policy_list);
- write_unlock_irqrestore(&cpufreq_driver_lock, flags);
-
free_cpumask_var(policy->related_cpus);
free_cpumask_var(policy->cpus);
kfree(policy);
ret = cpufreq_add_dev_interface(policy, dev);
if (ret)
goto err_out_unregister;
-
- write_lock_irqsave(&cpufreq_driver_lock, flags);
- list_add(&policy->policy_list, &cpufreq_policy_list);
- write_unlock_irqrestore(&cpufreq_driver_lock, flags);
}
+ write_lock_irqsave(&cpufreq_driver_lock, flags);
+ list_add(&policy->policy_list, &cpufreq_policy_list);
+ write_unlock_irqrestore(&cpufreq_driver_lock, flags);
+
cpufreq_init_policy(policy);
kobject_uevent(&policy->kobj, KOBJ_ADD);
if (cpufreq_driver->exit)
cpufreq_driver->exit(policy);
+ /* Remove policy from list of active policies */
+ write_lock_irqsave(&cpufreq_driver_lock, flags);
+ list_del(&policy->policy_list);
+ write_unlock_irqrestore(&cpufreq_driver_lock, flags);
+
if (!frozen)
cpufreq_policy_free(policy);
} else {