mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amit Daniel Kachhap <amit.daniel@samsung.com>
To: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org
Cc: Zhang Rui <rui.zhang@intel.com>,
	linux-kernel@vger.kernel.org, amit.kachhap@gmail.com,
	edubezval@gmail.com, rjw@rjwysocki.net,
	linux-arm-kernel@lists.infradead.org, lenb@kernel.org
Subject: [PATCH v1 5/6] thermal: thermal_core: Remove the max cooling limit check in registration
Date: Thu, 29 May 2014 13:45:33 +0530	[thread overview]
Message-ID: <1401351334-11210-6-git-send-email-amit.daniel@samsung.com> (raw)
In-Reply-To: <1401351334-11210-1-git-send-email-amit.daniel@samsung.com>

This is required as with the addition of the cooling notifiers mechanism the
client can enable some more cooling states at a later point of time and
hence max cooling state is dynamic entity now. Say when minimum p state
is reached then ACPI specific throttling is enabled which may add some
more cooling states.

Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
---
 drivers/thermal/step_wise.c    |    2 +-
 drivers/thermal/thermal_core.c |    9 +++------
 include/linux/thermal.h        |    1 +
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c
index f251521..7d65617 100644
--- a/drivers/thermal/step_wise.c
+++ b/drivers/thermal/step_wise.c
@@ -72,7 +72,7 @@ static unsigned long get_target_state(struct thermal_instance *instance,
 		}
 		break;
 	case THERMAL_TREND_RAISE_FULL:
-		if (throttle)
+		if (instance->upper != THERMAL_CSTATE_MAX && throttle)
 			next_target = instance->upper;
 		break;
 	case THERMAL_TREND_DROPPING:
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 1a60f83..743bb83 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -923,7 +923,6 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
 	struct thermal_instance *pos;
 	struct thermal_zone_device *pos1;
 	struct thermal_cooling_device *pos2;
-	unsigned long max_state;
 	int result;
 
 	if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE))
@@ -941,13 +940,11 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
 	if (tz != pos1 || cdev != pos2)
 		return -EINVAL;
 
-	cdev->ops->get_max_state(cdev, &max_state);
-
-	/* lower default 0, upper default max_state */
+	/* lower default 0, upper default THERMAL_CSTATE_MAX */
 	lower = lower == THERMAL_NO_LIMIT ? 0 : lower;
-	upper = upper == THERMAL_NO_LIMIT ? max_state : upper;
+	upper = upper == THERMAL_NO_LIMIT ? THERMAL_CSTATE_MAX : upper;
 
-	if (lower > upper || upper > max_state)
+	if (lower > upper)
 		return -EINVAL;
 
 	dev =
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 3fb1b92..6cfe8c8 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -36,6 +36,7 @@
 
 /* invalid cooling state */
 #define THERMAL_CSTATE_INVALID -1UL
+#define THERMAL_CSTATE_MAX 1UL
 
 /* No upper/lower limit requirement */
 #define THERMAL_NO_LIMIT	THERMAL_CSTATE_INVALID
-- 
1.7.1


  parent reply	other threads:[~2014-05-29  8:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29  8:15 [PATCH v1 0/6] ACPI: thermal: Migrate cpufreq cooling to generic cpu_cooling layer Amit Daniel Kachhap
2014-05-29  8:15 ` [PATCH v1 1/6] thermal: cpu_cooling: Fix the notification mechanism by using per cpu structure Amit Daniel Kachhap
2014-05-29  8:15 ` [PATCH v1 2/6] thermal: cpu_cooling: Support passing driver private data Amit Daniel Kachhap
2014-05-29 12:06   ` Javi Merino
2014-06-02  9:24     ` Amit Kachhap
2014-06-02 18:57       ` Eduardo Valentin
2014-05-29  8:15 ` [PATCH v1 3/6] thermal: thermal-core: Add notifications support for the cooling states Amit Daniel Kachhap
2014-05-29 12:24   ` Javi Merino
2014-06-02  9:31     ` Amit Kachhap
2014-06-02 10:14       ` Javi Merino
2014-05-29  8:15 ` [PATCH v1 4/6] thermal: cpu_cooling: Add support to find up/low frequency levels Amit Daniel Kachhap
2014-05-29  8:15 ` Amit Daniel Kachhap [this message]
2014-05-29  8:15 ` [PATCH v1 6/6] ACPI: thermal: processor: Use the generic cpufreq infrastructure Amit Daniel Kachhap
2014-05-29 12:42   ` Javi Merino
2014-06-02  9:21     ` Amit Kachhap
2014-06-02 10:20       ` Javi Merino
2014-06-02 17:36         ` Eduardo Valentin

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=1401351334-11210-6-git-send-email-amit.daniel@samsung.com \
    --to=amit.daniel@samsung.com \
    --cc=amit.kachhap@gmail.com \
    --cc=edubezval@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    /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®