lkml.org 
[lkml]   [2018]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 6/6] PM / devfreq: Reject client provided freq_table
Date
The devfreq profile's freq_table is an internal resource used to keep
track of all levels described in the associated opp table, in order to
support levels being enabled and disabled in runtime by e.g.
devfreq_cooling.

As it is required by the implementation that the device has an
associated opp table and expected that the freq_table matches this, it
is not possible for clients to provide a freq_table through the devfreq
profile.

Check for this in devfreq_add_device() and remove the unnecessary
conditional generation of the internal freq_table.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
drivers/devfreq/devfreq.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index c804bd72a644..3d1f6a2edf68 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -557,7 +557,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
static atomic_t devfreq_no = ATOMIC_INIT(-1);
int err = 0;

- if (!dev || !profile || !governor_name) {
+ if (!dev || !profile || !governor_name || profile->freq_table) {
dev_err(dev, "%s: Invalid parameters.\n", __func__);
return ERR_PTR(-EINVAL);
}
@@ -590,11 +590,9 @@ struct devfreq *devfreq_add_device(struct device *dev,
devfreq->data = data;
devfreq->nb.notifier_call = devfreq_notifier_call;

- if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {
- err = set_freq_table(devfreq);
- if (err < 0)
- goto err_dev;
- }
+ err = set_freq_table(devfreq);
+ if (err < 0)
+ goto err_dev;

devfreq->min_freq = find_available_min_freq(devfreq);
if (!devfreq->min_freq) {
--
2.16.2
\
 
 \ /
  Last update: 2018-04-25 00:36    [W:0.087 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site