mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: MyungJoo Ham <myungjoo.ham@samsung.com>
To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: myungjoo.ham@gmail.com, rjw@sisk.pl, kyungmin.park@samsung.com,
	khilman@ti.com, markgross@thegnar.org, jean.pihet@newoldbits.com,
	mturquette@ti.com, jonghwa3.lee@samsung.com
Subject: [PATCH v3 2/2] PM / devfreq: support per-dev PM-QoS in devfreq
Date: Thu, 30 Aug 2012 18:00:03 +0900	[thread overview]
Message-ID: <1346317203-7357-3-git-send-email-myungjoo.ham@samsung.com> (raw)
In-Reply-To: <1346317203-7357-1-git-send-email-myungjoo.ham@samsung.com>

Added support of per-dev PM-QoS request handling in devfreq core.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
---
 drivers/devfreq/devfreq.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index d74b382..e2ae575 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -268,6 +268,9 @@ static void _remove_devfreq(struct devfreq *devfreq, bool skip)
 
 	devfreq->being_removed = true;
 
+	if (devfreq->profile->enable_dev_pm_qos)
+		dev_pm_qos_remove_notifier(devfreq->dev.parent,
+					   &devfreq->qos_nb);
 	if (devfreq->profile->qos_type)
 		pm_qos_remove_notifier(devfreq->profile->qos_type,
 				       &devfreq->qos_nb);
@@ -484,13 +487,13 @@ struct devfreq *devfreq_add_device(struct device *dev,
 	devfreq->nb.notifier_call = devfreq_notifier_call;
 	devfreq->qos_nb.notifier_call = devfreq_qos_notifier_call;
 
-	/* Check the sanity of qos_list/qos_type */
-	if (profile->qos_type || profile->qos_list) {
-
-		if (WARN(!profile->qos_type || !profile->qos_list,
+	/* Check the sanity of QoS handling specifications */
+	if (profile->qos_type || profile->enable_dev_pm_qos ||
+	    profile->qos_list) {
+		if (WARN(!profile->qos_list ||
+			 (!profile->qos_type && !profile->enable_dev_pm_qos),
 			 "QoS requirement partially omitted for %s.\n",
 			 dev_name(dev))) {
-
 			err = -EINVAL;
 			goto err_dev;
 		}
@@ -498,7 +501,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
 		if (WARN(!profile->qos_list[0].freq,
 			 "The first QoS requirement is the end of list for %s.\n",
 			 dev_name(dev))) {
-
 			err = -EINVAL;
 			goto err_dev;
 		}
@@ -535,7 +537,11 @@ struct devfreq *devfreq_add_device(struct device *dev,
 			}
 		}
 
-		pm_qos_add_notifier(profile->qos_type, &devfreq->qos_nb);
+		if (profile->qos_type)
+			pm_qos_add_notifier(profile->qos_type,
+					    &devfreq->qos_nb);
+		if (profile->enable_dev_pm_qos)
+			dev_pm_qos_add_notifier(dev, &devfreq->qos_nb);
 	}
 
 	devfreq->trans_table =	devm_kzalloc(dev, sizeof(unsigned int) *
@@ -580,7 +586,9 @@ out:
 err_init:
 	device_unregister(&devfreq->dev);
 err_qos_add:
-	if (profile->qos_type || profile->qos_list)
+	if (profile->enable_dev_pm_qos)
+		dev_pm_qos_remove_notifier(dev, &devfreq->qos_nb);
+	if (profile->qos_type)
 		pm_qos_remove_notifier(profile->qos_type, &devfreq->qos_nb);
 err_dev:
 	mutex_unlock(&devfreq->lock);
-- 
1.7.4.1


      parent reply	other threads:[~2012-08-30  8:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30  9:00 [PATCH v3 0/2] PM / devfreq: support PM-QoS at devfreq core MyungJoo Ham
2012-08-30  9:00 ` [PATCH v3 1/2] PM / devfreq: add global PM QoS support MyungJoo Ham
2012-09-08 22:20   ` Rafael J. Wysocki
2012-08-30  9:00 ` MyungJoo Ham [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=1346317203-7357-3-git-send-email-myungjoo.ham@samsung.com \
    --to=myungjoo.ham@samsung.com \
    --cc=jean.pihet@newoldbits.com \
    --cc=jonghwa3.lee@samsung.com \
    --cc=khilman@ti.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=markgross@thegnar.org \
    --cc=mturquette@ti.com \
    --cc=myungjoo.ham@gmail.com \
    --cc=rjw@sisk.pl \
    /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

all inboxes | Powered by JetHome®