]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/cpufreq/cpufreq.c
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[linux.git] / drivers / cpufreq / cpufreq.c
index c28ebf2810f11508a1c36cb1660bdd949ef3aeff..c52d6fa32aac8125abfeadbac8ffe5d7e9cb5ff2 100644 (file)
@@ -1266,7 +1266,17 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
                                   DEV_PM_QOS_MAX_FREQUENCY);
        dev_pm_qos_remove_notifier(dev, &policy->nb_min,
                                   DEV_PM_QOS_MIN_FREQUENCY);
-       dev_pm_qos_remove_request(policy->max_freq_req);
+
+       if (policy->max_freq_req) {
+               /*
+                * CPUFREQ_CREATE_POLICY notification is sent only after
+                * successfully adding max_freq_req request.
+                */
+               blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
+                                            CPUFREQ_REMOVE_POLICY, policy);
+               dev_pm_qos_remove_request(policy->max_freq_req);
+       }
+
        dev_pm_qos_remove_request(policy->min_freq_req);
        kfree(policy->min_freq_req);
 
@@ -1391,6 +1401,9 @@ static int cpufreq_online(unsigned int cpu)
                                ret);
                        goto out_destroy_policy;
                }
+
+               blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
+                               CPUFREQ_CREATE_POLICY, policy);
        }
 
        if (cpufreq_driver->get && has_target()) {
@@ -1807,8 +1820,8 @@ void cpufreq_suspend(void)
                }
 
                if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy))
-                       pr_err("%s: Failed to suspend driver: %p\n", __func__,
-                               policy);
+                       pr_err("%s: Failed to suspend driver: %s\n", __func__,
+                               cpufreq_driver->name);
        }
 
 suspend:
@@ -2140,7 +2153,7 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
                          unsigned int target_freq,
                          unsigned int relation)
 {
-       int ret = -EINVAL;
+       int ret;
 
        down_write(&policy->rwsem);
 
@@ -2347,15 +2360,13 @@ EXPORT_SYMBOL(cpufreq_get_policy);
  * @policy: Policy object to modify.
  * @new_policy: New policy data.
  *
- * Pass @new_policy to the cpufreq driver's ->verify() callback, run the
- * installed policy notifiers for it with the CPUFREQ_ADJUST value, pass it to
- * the driver's ->verify() callback again and run the notifiers for it again
- * with the CPUFREQ_NOTIFY value.  Next, copy the min and max parameters
- * of @new_policy to @policy and either invoke the driver's ->setpolicy()
- * callback (if present) or carry out a governor update for @policy.  That is,
- * run the current governor's ->limits() callback (if the governor field in
- * @new_policy points to the same object as the one in @policy) or replace the
- * governor for @policy with the new one stored in @new_policy.
+ * Pass @new_policy to the cpufreq driver's ->verify() callback. Next, copy the
+ * min and max parameters of @new_policy to @policy and either invoke the
+ * driver's ->setpolicy() callback (if present) or carry out a governor update
+ * for @policy.  That is, run the current governor's ->limits() callback (if the
+ * governor field in @new_policy points to the same object as the one in
+ * @policy) or replace the governor for @policy with the new one stored in
+ * @new_policy.
  *
  * The cpuinfo part of @policy is not updated by this function.
  */
@@ -2383,26 +2394,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy,
        if (ret)
                return ret;
 
-       /*
-        * The notifier-chain shall be removed once all the users of
-        * CPUFREQ_ADJUST are moved to use the QoS framework.
-        */
-       /* adjust if necessary - all reasons */
-       blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
-                       CPUFREQ_ADJUST, new_policy);
-
-       /*
-        * verify the cpu speed can be set within this limit, which might be
-        * different to the first one
-        */
-       ret = cpufreq_driver->verify(new_policy);
-       if (ret)
-               return ret;
-
-       /* notification of the new policy */
-       blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
-                       CPUFREQ_NOTIFY, new_policy);
-
        policy->min = new_policy->min;
        policy->max = new_policy->max;
        trace_cpu_frequency_limits(policy);