From: Amit Daniel Kachhap <amit.daniel@samsung.com>
To: linux-pm@vger.kernel.org, Zhang Rui <rui.zhang@intel.com>
Cc: linux-kernel@vger.kernel.org, durgadoss.r@intel.com
Subject: [PATCH] Thermal: Fix to use read critical temperature when required
Date: Tue, 8 Jan 2013 16:18:59 -0800 [thread overview]
Message-ID: <1357690739-17009-1-git-send-email-amit.daniel@samsung.com> (raw)
This patch modifies the code to use get_crit_temp instead of
the normal get_trip_temp when critical threshold point is crossed
or queried about.
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
---
drivers/thermal/thermal_sys.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index ecdfc7d..0dc6403 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -345,7 +345,10 @@ static void handle_critical_trips(struct thermal_zone_device *tz,
{
long trip_temp;
- tz->ops->get_trip_temp(tz, trip, &trip_temp);
+ if (tz->ops->get_crit_temp)
+ tz->ops->get_crit_temp(tz, &trip_temp);
+ else
+ tz->ops->get_trip_temp(tz, trip, &trip_temp);
/* If we have not crossed the trip_temp, we do not care. */
if (tz->temperature < trip_temp)
@@ -550,6 +553,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr,
struct thermal_zone_device *tz = to_thermal_zone(dev);
int trip, ret;
long temperature;
+ enum thermal_trip_type type;
if (!tz->ops->get_trip_temp)
return -EPERM;
@@ -557,7 +561,14 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr,
if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip))
return -EINVAL;
- ret = tz->ops->get_trip_temp(tz, trip, &temperature);
+ ret = tz->ops->get_trip_type(tz, trip, &type);
+ if (ret)
+ return ret;
+
+ if (type == THERMAL_TRIP_CRITICAL && tz->ops->get_crit_temp)
+ ret = tz->ops->get_crit_temp(tz, &temperature);
+ else
+ ret = tz->ops->get_trip_temp(tz, trip, &temperature);
if (ret)
return ret;
--
1.7.10.4
next reply other threads:[~2013-01-09 0:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 0:18 Amit Daniel Kachhap [this message]
2013-02-01 5:44 ` [PATCH] Thermal: Fix to use read critical temperature when required Zhang Rui
2013-02-01 8:43 ` R, Durgadoss
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=1357690739-17009-1-git-send-email-amit.daniel@samsung.com \
--to=amit.daniel@samsung.com \
--cc=durgadoss.r@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@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