summaryrefslogtreecommitdiff
path: root/drivers/devfreq/governor_userspace.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/devfreq/governor_userspace.c')
-rw-r--r--drivers/devfreq/governor_userspace.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c
index 4f8b563da782..0681246fc89d 100644
--- a/drivers/devfreq/governor_userspace.c
+++ b/drivers/devfreq/governor_userspace.c
@@ -25,10 +25,19 @@ static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq)
{
struct userspace_data *data = df->data;
- if (!data->valid)
+ if (data->valid) {
+ unsigned long adjusted_freq = data->user_frequency;
+
+ if (df->max_freq && adjusted_freq > df->max_freq)
+ adjusted_freq = df->max_freq;
+
+ if (df->min_freq && adjusted_freq < df->min_freq)
+ adjusted_freq = df->min_freq;
+
+ *freq = adjusted_freq;
+ } else {
*freq = df->previous_freq; /* No user freq specified yet */
- else
- *freq = data->user_frequency;
+ }
return 0;
}