public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: linux-acpi@vger.kernel.org
Cc: Thomas Renninger <trenn@suse.de>, Len Brown <lenb@kernel.org>
Subject: [PATCH 2/2] ACPI thermal: Check for thermal zone requirement
Date: Tue, 16 Feb 2010 22:55:51 +0100	[thread overview]
Message-ID: <1266357351-20224-2-git-send-email-trenn@suse.de> (raw)
In-Reply-To: <1266357351-20224-1-git-send-email-trenn@suse.de>

ACPI spec says (11.5 Thermal Zone Interface Requirements):
   A thermal zone must contain at least one trip point
   (critical, near critical, active, or passive)

Check this once at init time.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Tested-by: clarkt@cnsp.com
CC: Len Brown <lenb@kernel.org>
CC: linux-acpi@vger.kernel.org
---
 drivers/acpi/thermal.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 8fa71b8..09b757a 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -577,7 +577,23 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 
 static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
 {
-	return acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT);
+	int i, valid, ret = acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT);
+
+	if (ret)
+		return ret;
+
+	valid = tz->trips.critical.flags.valid |
+		tz->trips.hot.flags.valid |
+		tz->trips.passive.flags.valid;
+
+	for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
+		valid |= tz->trips.active[i].flags.valid;
+
+	if (!valid) {
+		printk(KERN_WARNING FW_BUG "No valid trip found\n");
+		return -ENODEV;
+	}
+	return 0;
 }
 
 static void acpi_thermal_check(void *data)
-- 
1.6.3


  reply	other threads:[~2010-02-16 21:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-16 21:55 [PATCH 1/2] ACPI thermal: Don't invalidate thermal zone if critical trip point is bad Thomas Renninger
2010-02-16 21:55 ` Thomas Renninger [this message]
2010-02-19  6:39   ` [PATCH 2/2] ACPI thermal: Check for thermal zone requiremen Len Brown
2010-02-19 11:20     ` Thomas Renninger
2010-02-19 16:20       ` Len Brown
2010-02-19 16:37         ` Thomas Renninger
2010-02-20  4:57           ` Len Brown
2010-02-20  9:50             ` Thomas Renninger
2010-02-20 10:15         ` Thomas Renninger
2010-02-19  6:34 ` [PATCH 1/2] ACPI thermal: Don't invalidate thermal zone if critical trip point is bad Len Brown
2010-02-19  7:34   ` Len Brown
2010-02-20 10:20     ` [PATCH] " Thomas Renninger
2010-02-20 10:42       ` Thomas Renninger
2010-02-20 10:44 ` Thomas Renninger
2010-02-21  2:51   ` Zhang Rui
     [not found]     ` <201002220002.49341.trenn@suse.de>
2010-02-22  1:33       ` Zhang Rui

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=1266357351-20224-2-git-send-email-trenn@suse.de \
    --to=trenn@suse.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    /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