diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2019-07-23 02:14:01 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-08-10 08:05:48 -0400 |
commit | 6a1490367c44f94614e39e8b98ff7114ff8a6449 (patch) | |
tree | 05174410db32276aa84cad140437860a123276b3 | |
parent | e21a712a9685488f5ce80495b37b9fdbe96c230d (diff) |
cpufreq: Add policy create/remove notifiers back
This effectively reverts some changes made by commit f9f41e3ef99
("cpufreq: Remove policy create/remove notifiers").
We have a new use case for policy create/remove notifiers (for
allocating/freeing QoS requests per policy), so add them back.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Subject & changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 15 | ||||
-rw-r--r-- | include/linux/cpufreq.h | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 8dda62367816..c13dcb59b30c 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()) { |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 536a049d7ecc..afc10384a681 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -458,6 +458,8 @@ static inline void cpufreq_resume(void) {} | |||
458 | /* Policy Notifiers */ | 458 | /* Policy Notifiers */ |
459 | #define CPUFREQ_ADJUST (0) | 459 | #define CPUFREQ_ADJUST (0) |
460 | #define CPUFREQ_NOTIFY (1) | 460 | #define CPUFREQ_NOTIFY (1) |
461 | #define CPUFREQ_CREATE_POLICY (2) | ||
462 | #define CPUFREQ_REMOVE_POLICY (3) | ||
461 | 463 | ||
462 | #ifdef CONFIG_CPU_FREQ | 464 | #ifdef CONFIG_CPU_FREQ |
463 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); | 465 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); |