From db3bd10cf5e607535c2c256cbfb2405d723bb950 Mon Sep 17 00:00:00 2001 From: Elias Oltmanns Date: Mon, 22 Oct 2007 09:50:13 +0200 Subject: [PATCH] --- yaml --- r: 73879 b: refs/heads/master c: a8d7c3bc2396aff14f9e920677072cb55b016040 h: refs/heads/master i: 73877: 98c02855fe4cbae4f6b27d59e55ed16af72802fd 73875: 632c7e21b2bf777d4ed4d8ecc86f856db4b2ff7a 73871: fb6fa4a4919540113a7a3c25080f732a9b250601 v: v3 --- [refs] | 2 +- trunk/drivers/cpufreq/cpufreq_conservative.c | 32 ++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 2e222bb5a30e..fe0cc0eed196 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c5829cd07ec4c08daa7ff91c821af9b2ac7748df +refs/heads/master: a8d7c3bc2396aff14f9e920677072cb55b016040 diff --git a/trunk/drivers/cpufreq/cpufreq_conservative.c b/trunk/drivers/cpufreq/cpufreq_conservative.c index 4bd33ce8a6f3..57d02e990af3 100644 --- a/trunk/drivers/cpufreq/cpufreq_conservative.c +++ b/trunk/drivers/cpufreq/cpufreq_conservative.c @@ -116,6 +116,27 @@ static inline unsigned int get_cpu_idle_time(unsigned int cpu) return ret; } +/* keep track of frequency transitions */ +static int +dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val, + void *data) +{ + struct cpufreq_freqs *freq = data; + struct cpu_dbs_info_s *this_dbs_info = &per_cpu(cpu_dbs_info, + freq->cpu); + + if (!this_dbs_info->enable) + return 0; + + this_dbs_info->requested_freq = freq->new; + + return 0; +} + +static struct notifier_block dbs_cpufreq_notifier_block = { + .notifier_call = dbs_cpufreq_notifier +}; + /************************** sysfs interface ************************/ static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf) { @@ -511,6 +532,9 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, dbs_tuners_ins.sampling_rate = def_sampling_rate; dbs_timer_init(); + cpufreq_register_notifier( + &dbs_cpufreq_notifier_block, + CPUFREQ_TRANSITION_NOTIFIER); } mutex_unlock(&dbs_mutex); @@ -525,9 +549,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, * Stop the timerschedule work, when this governor * is used for first time */ - if (dbs_enable == 0) + if (dbs_enable == 0) { dbs_timer_exit(); - + cpufreq_unregister_notifier( + &dbs_cpufreq_notifier_block, + CPUFREQ_TRANSITION_NOTIFIER); + } + mutex_unlock(&dbs_mutex); break;