cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Use sampling_rate_min/max if value beyond limit is written to ondemand/sampling_rate
@ 2006-05-30 18:14 Holger Macht
  0 siblings, 0 replies; only message in thread
From: Holger Macht @ 2006-05-30 18:14 UTC (permalink / raw)
  To: cpufreq

If a value lower then sampling_rate_min or greater than sampling_rate_max
is written to ondemand/sampling_rate, the request ist ignored and a write
error is thrown. Patch takes sampling_rate_min/max into account if a value
beyond the limit is written.

This leads to consistent behaviour between ondemand/sampling_rate and the
userspace governor scaling_setspeed interface, where one can write a
frequency lower than scaling_min_freq and scaling_min_freq is actually
used instead of the setting being ignored.

Signed-off-by: Holger Macht <hmacht@suse.de>
---
 cpufreq_ondemand.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- linux-2.6.17-rc5.orig/drivers/cpufreq/cpufreq_ondemand.c	2006-05-30 14:11:38.000000000 +0200
+++ linux-2.6.17-rc5/drivers/cpufreq/cpufreq_ondemand.c	2006-05-27 17:58:09.000000000 +0200
@@ -155,11 +155,16 @@ static ssize_t store_sampling_rate(struc
 	ret = sscanf (buf, "%u", &input);
 
 	mutex_lock(&dbs_mutex);
-	if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) {
+	if (ret != 1) {
 		mutex_unlock(&dbs_mutex);
 		return -EINVAL;
 	}
 
+	if (input > MAX_SAMPLING_RATE)
+		input = MAX_SAMPLING_RATE;
+	else if (input < MIN_SAMPLING_RATE)
+		input = MIN_SAMPLING_RATE;
+
 	dbs_tuners_ins.sampling_rate = input;
 	mutex_unlock(&dbs_mutex);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-30 18:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-30 18:14 [PATCH] Use sampling_rate_min/max if value beyond limit is written to ondemand/sampling_rate Holger Macht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox