* [PATCH] Thermal: Fix to use read critical temperature when required
@ 2013-01-09 0:18 Amit Daniel Kachhap
2013-02-01 5:44 ` Zhang Rui
0 siblings, 1 reply; 4+ messages in thread
From: Amit Daniel Kachhap @ 2013-01-09 0:18 UTC (permalink / raw)
To: linux-pm, Zhang Rui; +Cc: linux-kernel, durgadoss.r
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Thermal: Fix to use read critical temperature when required
2013-01-09 0:18 [PATCH] Thermal: Fix to use read critical temperature when required Amit Daniel Kachhap
@ 2013-02-01 5:44 ` Zhang Rui
2013-02-01 8:43 ` R, Durgadoss
0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2013-02-01 5:44 UTC (permalink / raw)
To: Amit Daniel Kachhap; +Cc: linux-pm, linux-kernel, durgadoss.r
On Tue, 2013-01-08 at 16:18 -0800, Amit Daniel Kachhap wrote:
> 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.
>
is there any problem in the current code?
> 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);
>
handle_critical_trips() can handle both active and hot trip points.
this change will break HOT trip point.
> /* 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);
>
what's the benefit of using .get_crit_temp() instead of .get_trip_temp()
for CRITICAL trip points here?
.get_trip_point can also get the critical trip point temperature.
instead, I think we could remove .get_crit_temp callback.
for hwmon sysfs, we just need to use get_trip_type to find the critical
trip point.
thanks,
rui
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] Thermal: Fix to use read critical temperature when required
2013-02-01 5:44 ` Zhang Rui
@ 2013-02-01 8:43 ` R, Durgadoss
0 siblings, 0 replies; 4+ messages in thread
From: R, Durgadoss @ 2013-02-01 8:43 UTC (permalink / raw)
To: Zhang, Rui, Amit Daniel Kachhap; +Cc: linux-pm, linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2886 bytes --]
> -----Original Message-----
> From: Zhang, Rui
> Sent: Friday, February 01, 2013 11:14 AM
> To: Amit Daniel Kachhap
> Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; R, Durgadoss
> Subject: Re: [PATCH] Thermal: Fix to use read critical temperature when
> required
>
> On Tue, 2013-01-08 at 16:18 -0800, Amit Daniel Kachhap wrote:
> > 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.
> >
>
> is there any problem in the current code?
>
> > 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);
> >
> handle_critical_trips() can handle both active and hot trip points.
> this change will break HOT trip point.
>
> > /* 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);
> >
>
> what's the benefit of using .get_crit_temp() instead of .get_trip_temp()
> for CRITICAL trip points here?
> .get_trip_point can also get the critical trip point temperature.
>
> instead, I think we could remove .get_crit_temp callback.
I agree with you Rui here :-)
> for hwmon sysfs, we just need to use get_trip_type to find the critical
> trip point.
Yes, this should work.
Thanks,
Durga
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] Thermal: Fix to use read critical temperature when required
@ 2013-02-01 8:43 ` R, Durgadoss
0 siblings, 0 replies; 4+ messages in thread
From: R, Durgadoss @ 2013-02-01 8:43 UTC (permalink / raw)
To: Zhang, Rui, Amit Daniel Kachhap; +Cc: linux-pm, linux-kernel
> -----Original Message-----
> From: Zhang, Rui
> Sent: Friday, February 01, 2013 11:14 AM
> To: Amit Daniel Kachhap
> Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; R, Durgadoss
> Subject: Re: [PATCH] Thermal: Fix to use read critical temperature when
> required
>
> On Tue, 2013-01-08 at 16:18 -0800, Amit Daniel Kachhap wrote:
> > 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.
> >
>
> is there any problem in the current code?
>
> > 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);
> >
> handle_critical_trips() can handle both active and hot trip points.
> this change will break HOT trip point.
>
> > /* 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);
> >
>
> what's the benefit of using .get_crit_temp() instead of .get_trip_temp()
> for CRITICAL trip points here?
> .get_trip_point can also get the critical trip point temperature.
>
> instead, I think we could remove .get_crit_temp callback.
I agree with you Rui here :-)
> for hwmon sysfs, we just need to use get_trip_type to find the critical
> trip point.
Yes, this should work.
Thanks,
Durga
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-01 8:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-09 0:18 [PATCH] Thermal: Fix to use read critical temperature when required Amit Daniel Kachhap
2013-02-01 5:44 ` Zhang Rui
2013-02-01 8:43 ` R, Durgadoss
2013-02-01 8:43 ` R, Durgadoss
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.