LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] PM / devfreq: Reject client provided freq_table
Date: Tue, 24 Apr 2018 15:35:21 -0700	[thread overview]
Message-ID: <20180424223521.28193-7-bjorn.andersson@linaro.org> (raw)
In-Reply-To: <20180424223521.28193-1-bjorn.andersson@linaro.org>

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

      parent reply	other threads:[~2018-04-24 22:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-24 22:35 [PATCH 0/6] Misc devfreq_add_device() fixes Bjorn Andersson
2018-04-24 22:35 ` [PATCH 1/6] PM / devfreq: Free devfreq upon set_freq_table error Bjorn Andersson
2018-04-24 22:35 ` [PATCH 2/6] PM / devfreq: Use the device release function for cleanup Bjorn Andersson
2018-04-24 22:35 ` [PATCH 3/6] PM / devfreq: Reorder devfreq_add_device() Bjorn Andersson
2018-04-24 22:35 ` [PATCH 4/6] PM / devfreq: Remove unnecessary locking Bjorn Andersson
2018-04-24 22:35 ` [PATCH 5/6] PM / devfreq: Use put_device() on device_register error Bjorn Andersson
2018-04-24 22:35 ` Bjorn Andersson [this message]

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=20180424223521.28193-7-bjorn.andersson@linaro.org \
    --to=bjorn.andersson@linaro.org \
    --cc=cw00.choi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --subject='Re: [PATCH 6/6] PM / devfreq: Reject client provided freq_table' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).