summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c57
1 files changed, 24 insertions, 33 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index c28ebf2810f1..c52d6fa32aac 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1266,7 +1266,17 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
1266 DEV_PM_QOS_MAX_FREQUENCY); 1266 DEV_PM_QOS_MAX_FREQUENCY);
1267 dev_pm_qos_remove_notifier(dev, &policy->nb_min, 1267 dev_pm_qos_remove_notifier(dev, &policy->nb_min,
1268 DEV_PM_QOS_MIN_FREQUENCY); 1268 DEV_PM_QOS_MIN_FREQUENCY);
1269 dev_pm_qos_remove_request(policy->max_freq_req); 1269
1270 if (policy->max_freq_req) {
1271 /*
1272 * CPUFREQ_CREATE_POLICY notification is sent only after
1273 * successfully adding max_freq_req request.
1274 */
1275 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
1276 CPUFREQ_REMOVE_POLICY, policy);
1277 dev_pm_qos_remove_request(policy->max_freq_req);
1278 }
1279
1270 dev_pm_qos_remove_request(policy->min_freq_req); 1280 dev_pm_qos_remove_request(policy->min_freq_req);
1271 kfree(policy->min_freq_req); 1281 kfree(policy->min_freq_req);
1272 1282
@@ -1391,6 +1401,9 @@ static int cpufreq_online(unsigned int cpu)
1391 ret); 1401 ret);
1392 goto out_destroy_policy; 1402 goto out_destroy_policy;
1393 } 1403 }
1404
1405 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
1406 CPUFREQ_CREATE_POLICY, policy);
1394 } 1407 }
1395 1408
1396 if (cpufreq_driver->get && has_target()) { 1409 if (cpufreq_driver->get && has_target()) {
@@ -1807,8 +1820,8 @@ void cpufreq_suspend(void)
1807 } 1820 }
1808 1821
1809 if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy)) 1822 if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy))
1810 pr_err("%s: Failed to suspend driver: %p\n", __func__, 1823 pr_err("%s: Failed to suspend driver: %s\n", __func__,
1811 policy); 1824 cpufreq_driver->name);
1812 } 1825 }
1813 1826
1814suspend: 1827suspend:
@@ -2140,7 +2153,7 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
2140 unsigned int target_freq, 2153 unsigned int target_freq,
2141 unsigned int relation) 2154 unsigned int relation)
2142{ 2155{
2143 int ret = -EINVAL; 2156 int ret;
2144 2157
2145 down_write(&policy->rwsem); 2158 down_write(&policy->rwsem);
2146 2159
@@ -2347,15 +2360,13 @@ EXPORT_SYMBOL(cpufreq_get_policy);
2347 * @policy: Policy object to modify. 2360 * @policy: Policy object to modify.
2348 * @new_policy: New policy data. 2361 * @new_policy: New policy data.
2349 * 2362 *
2350 * Pass @new_policy to the cpufreq driver's ->verify() callback, run the 2363 * Pass @new_policy to the cpufreq driver's ->verify() callback. Next, copy the
2351 * installed policy notifiers for it with the CPUFREQ_ADJUST value, pass it to 2364 * min and max parameters of @new_policy to @policy and either invoke the
2352 * the driver's ->verify() callback again and run the notifiers for it again 2365 * driver's ->setpolicy() callback (if present) or carry out a governor update
2353 * with the CPUFREQ_NOTIFY value. Next, copy the min and max parameters 2366 * for @policy. That is, run the current governor's ->limits() callback (if the
2354 * of @new_policy to @policy and either invoke the driver's ->setpolicy() 2367 * governor field in @new_policy points to the same object as the one in
2355 * callback (if present) or carry out a governor update for @policy. That is, 2368 * @policy) or replace the governor for @policy with the new one stored in
2356 * run the current governor's ->limits() callback (if the governor field in 2369 * @new_policy.
2357 * @new_policy points to the same object as the one in @policy) or replace the
2358 * governor for @policy with the new one stored in @new_policy.
2359 * 2370 *
2360 * The cpuinfo part of @policy is not updated by this function. 2371 * The cpuinfo part of @policy is not updated by this function.
2361 */ 2372 */
@@ -2383,26 +2394,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy,
2383 if (ret) 2394 if (ret)
2384 return ret; 2395 return ret;
2385 2396
2386 /*
2387 * The notifier-chain shall be removed once all the users of
2388 * CPUFREQ_ADJUST are moved to use the QoS framework.
2389 */
2390 /* adjust if necessary - all reasons */
2391 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
2392 CPUFREQ_ADJUST, new_policy);
2393
2394 /*
2395 * verify the cpu speed can be set within this limit, which might be
2396 * different to the first one
2397 */
2398 ret = cpufreq_driver->verify(new_policy);
2399 if (ret)
2400 return ret;
2401
2402 /* notification of the new policy */
2403 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
2404 CPUFREQ_NOTIFY, new_policy);
2405
2406 policy->min = new_policy->min; 2397 policy->min = new_policy->min;
2407 policy->max = new_policy->max; 2398 policy->max = new_policy->max;
2408 trace_cpu_frequency_limits(policy); 2399 trace_cpu_frequency_limits(policy);