diff mbox

Thermal/int3403: Fix thermal hysteresis unit conversion

Message ID 1415008381-11584-1-git-send-email-srinivas.pandruvada@linux.intel.com (mailing list archive)
State Accepted
Delegated to: Eduardo Valentin
Headers show

Commit Message

Srinivas Pandruvada Nov. 3, 2014, 9:53 a.m. UTC
From: "lan,Tianyu" <tianyu.lan@intel.com>

Thermal hysteresis represents a temperature difference.
But the original code treats it as a temperature value,
Convert it from tenths of degree Kelvin to Milli-Celsius
by deducing 273200. This is not right.

Kelvin and Celsius have same degree size. From temperature
difference view, the conversion between tenths of degree
Kelvin unit and Milli-Celsius unit is just to multiply 100.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/int340x_thermal/int3403_thermal.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Zhang, Rui Nov. 4, 2014, 1:50 a.m. UTC | #1
On ?, 2014-11-03 at 01:53 -0800, Srinivas Pandruvada wrote:
> From: "lan,Tianyu" <tianyu.lan@intel.com>
> 
> Thermal hysteresis represents a temperature difference.
> But the original code treats it as a temperature value,
> Convert it from tenths of degree Kelvin to Milli-Celsius
> by deducing 273200. This is not right.
> 
> Kelvin and Celsius have same degree size. From temperature
> difference view, the conversion between tenths of degree
> Kelvin unit and Milli-Celsius unit is just to multiply 100.
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>

Hi, Eduardo,

can you please queue this patch for 3.18-rc5?

thanks,
rui
> ---
>  drivers/thermal/int340x_thermal/int3403_thermal.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c
> index d20dba9..6e9fb62 100644
> --- a/drivers/thermal/int340x_thermal/int3403_thermal.c
> +++ b/drivers/thermal/int340x_thermal/int3403_thermal.c
> @@ -92,7 +92,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
>  	if (ACPI_FAILURE(status))
>  		return -EIO;
>  
> -	*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET);
> +	/*
> +	 * Thermal hysteresis represents a temperature difference.
> +	 * Kelvin and Celsius have same degree size. So the
> +	 * conversion here between tenths of degree Kelvin unit
> +	 * and Milli-Celsius unit is just to multiply 100.
> +	 */
> +	*temp = hyst * 100;
>  
>  	return 0;
>  }


--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eduardo Valentin Nov. 4, 2014, 11:31 p.m. UTC | #2
Rui,

On Tue, Nov 04, 2014 at 09:50:34AM +0800, Zhang Rui wrote:
> On ?, 2014-11-03 at 01:53 -0800, Srinivas Pandruvada wrote:
> > From: "lan,Tianyu" <tianyu.lan@intel.com>
> > 
> > Thermal hysteresis represents a temperature difference.
> > But the original code treats it as a temperature value,
> > Convert it from tenths of degree Kelvin to Milli-Celsius
> > by deducing 273200. This is not right.
> > 
> > Kelvin and Celsius have same degree size. From temperature
> > difference view, the conversion between tenths of degree
> > Kelvin unit and Milli-Celsius unit is just to multiply 100.
> > 
> > Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> > Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> > Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> 
> Hi, Eduardo,
> 
> can you please queue this patch for 3.18-rc5?
> 

Pulled into my -fixes queue. Thanks.

> thanks,
> rui
> > ---
> >  drivers/thermal/int340x_thermal/int3403_thermal.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c
> > index d20dba9..6e9fb62 100644
> > --- a/drivers/thermal/int340x_thermal/int3403_thermal.c
> > +++ b/drivers/thermal/int340x_thermal/int3403_thermal.c
> > @@ -92,7 +92,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
> >  	if (ACPI_FAILURE(status))
> >  		return -EIO;
> >  
> > -	*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET);
> > +	/*
> > +	 * Thermal hysteresis represents a temperature difference.
> > +	 * Kelvin and Celsius have same degree size. So the
> > +	 * conversion here between tenths of degree Kelvin unit
> > +	 * and Milli-Celsius unit is just to multiply 100.
> > +	 */
> > +	*temp = hyst * 100;
> >  
> >  	return 0;
> >  }
> 
>
diff mbox

Patch

diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c
index d20dba9..6e9fb62 100644
--- a/drivers/thermal/int340x_thermal/int3403_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3403_thermal.c
@@ -92,7 +92,13 @@  static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
 	if (ACPI_FAILURE(status))
 		return -EIO;
 
-	*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET);
+	/*
+	 * Thermal hysteresis represents a temperature difference.
+	 * Kelvin and Celsius have same degree size. So the
+	 * conversion here between tenths of degree Kelvin unit
+	 * and Milli-Celsius unit is just to multiply 100.
+	 */
+	*temp = hyst * 100;
 
 	return 0;
 }