From: Holger Macht <hmacht@suse.de>
To: cpufreq@lists.linux.org.uk
Subject: [PATCH] Use sampling_rate_min/max if value beyond limit is written to ondemand/sampling_rate
Date: Tue, 30 May 2006 20:14:17 +0200 [thread overview]
Message-ID: <20060530181417.GB2374@linux-ersb> (raw)
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);
reply other threads:[~2006-05-30 18:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060530181417.GB2374@linux-ersb \
--to=hmacht@suse.de \
--cc=cpufreq@lists.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox