linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Lam <lambchop468@gmail.com>
To: Zhang Rui <rui.zhang@intel.com>, Durgadoss R <durgadoss.r@intel.com>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexander Lam <lambchop468@gmail.com>
Subject: [PATCH 1/1] thermal: Check cooling device's current state before declaring it inactive
Date: Sun, 30 Dec 2012 13:57:36 -0500	[thread overview]
Message-ID: <1356893856-26249-1-git-send-email-lambchop468@gmail.com> (raw)

It is possible for a cooling device to become active in between calls to
the thermal governor. An example of this is the acerhdf driver, which
can hand control of the cooling device over to the system firmware. Upon
returning control back to the thermal system, the cooling device might
be running again, so checking the current state of the cooling device is
required.

Signed-off-by: Alexander Lam <lambchop468@gmail.com>
---
 drivers/thermal/step_wise.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c
index 0cd5e9f..0eeb709 100644
--- a/drivers/thermal/step_wise.c
+++ b/drivers/thermal/step_wise.c
@@ -94,16 +94,21 @@ static void update_instance_for_dethrottle(struct thermal_zone_device *tz,
 	unsigned long cur_state;
 
 	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
-		if (instance->trip != trip ||
-			instance->target == THERMAL_NO_TARGET)
+		if (instance->trip != trip)
 			continue;
 
 		cdev = instance->cdev;
 		cdev->ops->get_cur_state(cdev, &cur_state);
 
-		instance->target = cur_state > instance->lower ?
+		cur_state = cur_state > instance->lower ?
 			    (cur_state - 1) : THERMAL_NO_TARGET;
 
+		if (cur_state == THERMAL_NO_TARGET &&
+					instance->target == THERMAL_NO_TARGET)
+			continue;
+
+		instance->target = cur_state;
+
 		/* Deactivate a passive thermal instance */
 		if (instance->target == THERMAL_NO_TARGET)
 			update_passive_instance(tz, trip_type, -1);
-- 
1.8.0.2


                 reply	other threads:[~2012-12-30 19:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1356893856-26249-1-git-send-email-lambchop468@gmail.com \
    --to=lambchop468@gmail.com \
    --cc=durgadoss.r@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).