linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux/thermal.h: rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS
@ 2015-10-01 21:45 Rasmus Villemoes
  2015-10-06 22:30 ` Darren Hart
  0 siblings, 1 reply; 5+ messages in thread
From: Rasmus Villemoes @ 2015-10-01 21:45 UTC (permalink / raw)
  To: Zhang Rui, Rafael J. Wysocki
  Cc: linux-acpi, linux-kernel, Guenter Roeck, linux-pm, Rasmus Villemoes

The macros KELVIN_TO_CELSIUS and CELSIUS_TO_KELVIN actually convert
between deciKelvins and Celsius, so rename them to reflect that. While
at it, use a statement expression in DECI_KELVIN_TO_CELSIUS to prevent
expanding the argument multiple times and get rid of a few casts.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
Cleaning out old branches, I stumbled on this which apparently fell
through the cracks
[http://thread.gmane.org/gmane.linux.drivers.platform.x86.devel/5349]. The
unit mismatch still bugs the physicist in me, so I'm resending.

 drivers/acpi/thermal.c              | 12 ++++++------
 drivers/platform/x86/asus-wmi.c     |  2 +-
 drivers/platform/x86/intel_menlow.c |  8 ++++----
 include/linux/thermal.h             |  8 +++++---
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 30d8518b25fb..82707f9824ca 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -315,7 +315,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 			if (crt == -1) {
 				tz->trips.critical.flags.valid = 0;
 			} else if (crt > 0) {
-				unsigned long crt_k = CELSIUS_TO_KELVIN(crt);
+				unsigned long crt_k = CELSIUS_TO_DECI_KELVIN(crt);
 				/*
 				 * Allow override critical threshold
 				 */
@@ -351,7 +351,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 		if (psv == -1) {
 			status = AE_SUPPORT;
 		} else if (psv > 0) {
-			tmp = CELSIUS_TO_KELVIN(psv);
+			tmp = CELSIUS_TO_DECI_KELVIN(psv);
 			status = AE_OK;
 		} else {
 			status = acpi_evaluate_integer(tz->device->handle,
@@ -431,7 +431,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 					break;
 				if (i == 1)
 					tz->trips.active[0].temperature =
-						CELSIUS_TO_KELVIN(act);
+						CELSIUS_TO_DECI_KELVIN(act);
 				else
 					/*
 					 * Don't allow override higher than
@@ -439,9 +439,9 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 					 */
 					tz->trips.active[i - 1].temperature =
 						(tz->trips.active[i - 2].temperature <
-						CELSIUS_TO_KELVIN(act) ?
+						CELSIUS_TO_DECI_KELVIN(act) ?
 						tz->trips.active[i - 2].temperature :
-						CELSIUS_TO_KELVIN(act));
+						CELSIUS_TO_DECI_KELVIN(act));
 				break;
 			} else {
 				tz->trips.active[i].temperature = tmp;
@@ -1105,7 +1105,7 @@ static int acpi_thermal_add(struct acpi_device *device)
 	INIT_WORK(&tz->thermal_check_work, acpi_thermal_check_fn);
 
 	pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device),
-		acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature));
+		acpi_device_bid(device), DECI_KELVIN_TO_CELSIUS(tz->temperature));
 	goto end;
 
 free_memory:
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index efbc3f0c592b..bb80f7a29496 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1318,7 +1318,7 @@ static ssize_t asus_hwmon_temp1(struct device *dev,
 	if (err < 0)
 		return err;
 
-	value = KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000;
+	value = DECI_KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000;
 
 	return sprintf(buf, "%d\n", value);
 }
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c
index e8b46d2c468c..0a919d81662c 100644
--- a/drivers/platform/x86/intel_menlow.c
+++ b/drivers/platform/x86/intel_menlow.c
@@ -315,7 +315,7 @@ static ssize_t aux0_show(struct device *dev,
 
 	result = sensor_get_auxtrip(attr->handle, 0, &value);
 
-	return result ? result : sprintf(buf, "%lu", KELVIN_TO_CELSIUS(value));
+	return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value));
 }
 
 static ssize_t aux1_show(struct device *dev,
@@ -327,7 +327,7 @@ static ssize_t aux1_show(struct device *dev,
 
 	result = sensor_get_auxtrip(attr->handle, 1, &value);
 
-	return result ? result : sprintf(buf, "%lu", KELVIN_TO_CELSIUS(value));
+	return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value));
 }
 
 static ssize_t aux0_store(struct device *dev,
@@ -345,7 +345,7 @@ static ssize_t aux0_store(struct device *dev,
 	if (value < 0)
 		return -EINVAL;
 
-	result = sensor_set_auxtrip(attr->handle, 0, CELSIUS_TO_KELVIN(value));
+	result = sensor_set_auxtrip(attr->handle, 0, CELSIUS_TO_DECI_KELVIN(value));
 	return result ? result : count;
 }
 
@@ -364,7 +364,7 @@ static ssize_t aux1_store(struct device *dev,
 	if (value < 0)
 		return -EINVAL;
 
-	result = sensor_set_auxtrip(attr->handle, 1, CELSIUS_TO_KELVIN(value));
+	result = sensor_set_auxtrip(attr->handle, 1, CELSIUS_TO_DECI_KELVIN(value));
 	return result ? result : count;
 }
 
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 157d366e761b..4014a59828fc 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -44,9 +44,11 @@
 #define THERMAL_WEIGHT_DEFAULT 0
 
 /* Unit conversion macros */
-#define KELVIN_TO_CELSIUS(t)	(long)(((long)t-2732 >= 0) ?	\
-				((long)t-2732+5)/10 : ((long)t-2732-5)/10)
-#define CELSIUS_TO_KELVIN(t)	((t)*10+2732)
+#define DECI_KELVIN_TO_CELSIUS(t)	({			\
+	long _t = (t);						\
+	((_t-2732 >= 0) ? (_t-2732+5)/10 : (_t-2732-5)/10);	\
+})
+#define CELSIUS_TO_DECI_KELVIN(t)	((t)*10+2732)
 #define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100)
 #define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732)
 #define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off))
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] linux/thermal.h: rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS
  2015-10-01 21:45 [PATCH] linux/thermal.h: rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS Rasmus Villemoes
@ 2015-10-06 22:30 ` Darren Hart
  0 siblings, 0 replies; 5+ messages in thread
From: Darren Hart @ 2015-10-06 22:30 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Zhang Rui, Rafael J. Wysocki, linux-acpi, linux-kernel,
	Guenter Roeck, linux-pm

On Thu, Oct 01, 2015 at 11:45:31PM +0200, Rasmus Villemoes wrote:
> The macros KELVIN_TO_CELSIUS and CELSIUS_TO_KELVIN actually convert
> between deciKelvins and Celsius, so rename them to reflect that. While
> at it, use a statement expression in DECI_KELVIN_TO_CELSIUS to prevent
> expanding the argument multiple times and get rid of a few casts.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

If Zhang and Rafael are happy with the termal change, then for the
resulting platform/drivers/x86 changes:

Acked-by: Darren Hart <dvhart@linux.intel.com>

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] linux/thermal.h: Rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS
  2014-03-24 17:29 [PATCH] linux/thermal.h: Rename " Rasmus Villemoes
  2014-03-24 17:45 ` Javi Merino
@ 2014-04-03  2:42 ` Zhang Rui
  1 sibling, 0 replies; 5+ messages in thread
From: Zhang Rui @ 2014-04-03  2:42 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Len Brown, Rafael J. Wysocki, Corentin Chary, Matthew Garrett,
	Sujith Thomas, Eduardo Valentin, linux-acpi, linux-kernel,
	acpi4asus-user, platform-driver-x86, linux-pm

On Mon, 2014-03-24 at 18:29 +0100, Rasmus Villemoes wrote:
> The macros KELVIN_TO_CELSIUS and CELSIUS_TO_KELVIN actually work on
> decikelvins, so rename them to reflect their actual semantics.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

applied on top of Guenter' "Fix KELVIN_TO_CELSIUS macro" patch.

thanks,
rui
> ---
>  drivers/acpi/thermal.c              | 12 ++++++------
>  drivers/platform/x86/asus-wmi.c     |  2 +-
>  drivers/platform/x86/intel_menlow.c |  8 ++++----
>  include/linux/thermal.h             |  6 +++---
>  4 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index 08626c8..3742e64 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -313,7 +313,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
>  			if (crt == -1) {
>  				tz->trips.critical.flags.valid = 0;
>  			} else if (crt > 0) {
> -				unsigned long crt_k = CELSIUS_TO_KELVIN(crt);
> +				unsigned long crt_k = CELSIUS_TO_DECI_KELVIN(crt);
>  				/*
>  				 * Allow override critical threshold
>  				 */
> @@ -349,7 +349,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
>  		if (psv == -1) {
>  			status = AE_SUPPORT;
>  		} else if (psv > 0) {
> -			tmp = CELSIUS_TO_KELVIN(psv);
> +			tmp = CELSIUS_TO_DECI_KELVIN(psv);
>  			status = AE_OK;
>  		} else {
>  			status = acpi_evaluate_integer(tz->device->handle,
> @@ -429,7 +429,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
>  					break;
>  				if (i == 1)
>  					tz->trips.active[0].temperature =
> -						CELSIUS_TO_KELVIN(act);
> +						CELSIUS_TO_DECI_KELVIN(act);
>  				else
>  					/*
>  					 * Don't allow override higher than
> @@ -437,9 +437,9 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
>  					 */
>  					tz->trips.active[i - 1].temperature =
>  						(tz->trips.active[i - 2].temperature <
> -						CELSIUS_TO_KELVIN(act) ?
> +						CELSIUS_TO_DECI_KELVIN(act) ?
>  						tz->trips.active[i - 2].temperature :
> -						CELSIUS_TO_KELVIN(act));
> +						CELSIUS_TO_DECI_KELVIN(act));
>  				break;
>  			} else {
>  				tz->trips.active[i].temperature = tmp;
> @@ -1094,7 +1094,7 @@ static int acpi_thermal_add(struct acpi_device *device)
>  		goto free_memory;
>  
>  	pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device),
> -		acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature));
> +		acpi_device_bid(device), DECI_KELVIN_TO_CELSIUS(tz->temperature));
>  	goto end;
>  
>  free_memory:
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index c5e082f..2d81d5a 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -1066,7 +1066,7 @@ static ssize_t asus_hwmon_temp1(struct device *dev,
>  	if (err < 0)
>  		return err;
>  
> -	value = KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000;
> +	value = DECI_KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000;
>  
>  	return sprintf(buf, "%d\n", value);
>  }
> diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c
> index e8b46d2..0a919d8 100644
> --- a/drivers/platform/x86/intel_menlow.c
> +++ b/drivers/platform/x86/intel_menlow.c
> @@ -315,7 +315,7 @@ static ssize_t aux0_show(struct device *dev,
>  
>  	result = sensor_get_auxtrip(attr->handle, 0, &value);
>  
> -	return result ? result : sprintf(buf, "%lu", KELVIN_TO_CELSIUS(value));
> +	return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value));
>  }
>  
>  static ssize_t aux1_show(struct device *dev,
> @@ -327,7 +327,7 @@ static ssize_t aux1_show(struct device *dev,
>  
>  	result = sensor_get_auxtrip(attr->handle, 1, &value);
>  
> -	return result ? result : sprintf(buf, "%lu", KELVIN_TO_CELSIUS(value));
> +	return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value));
>  }
>  
>  static ssize_t aux0_store(struct device *dev,
> @@ -345,7 +345,7 @@ static ssize_t aux0_store(struct device *dev,
>  	if (value < 0)
>  		return -EINVAL;
>  
> -	result = sensor_set_auxtrip(attr->handle, 0, CELSIUS_TO_KELVIN(value));
> +	result = sensor_set_auxtrip(attr->handle, 0, CELSIUS_TO_DECI_KELVIN(value));
>  	return result ? result : count;
>  }
>  
> @@ -364,7 +364,7 @@ static ssize_t aux1_store(struct device *dev,
>  	if (value < 0)
>  		return -EINVAL;
>  
> -	result = sensor_set_auxtrip(attr->handle, 1, CELSIUS_TO_KELVIN(value));
> +	result = sensor_set_auxtrip(attr->handle, 1, CELSIUS_TO_DECI_KELVIN(value));
>  	return result ? result : count;
>  }
>  
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index f7e11c7..c978aa3 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -41,9 +41,9 @@
>  #define THERMAL_NO_LIMIT	THERMAL_CSTATE_INVALID
>  
>  /* Unit conversion macros */
> -#define KELVIN_TO_CELSIUS(t)	(long)(((long)t-2732 >= 0) ?	\
> -				((long)t-2732+5)/10 : ((long)t-2732-5)/10)
> -#define CELSIUS_TO_KELVIN(t)	((t)*10+2732)
> +#define DECI_KELVIN_TO_CELSIUS(t)	(long)(((long)t-2732 >= 0) ?	\
> +					((long)t-2732+5)/10 : ((long)t-2732-5)/10)
> +#define CELSIUS_TO_DECI_KELVIN(t)	((t)*10+2732)
>  
>  /* Adding event notification support elements */
>  #define THERMAL_GENL_FAMILY_NAME                "thermal_event"



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] linux/thermal.h: Rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS
  2014-03-24 17:29 [PATCH] linux/thermal.h: Rename " Rasmus Villemoes
@ 2014-03-24 17:45 ` Javi Merino
  2014-04-03  2:42 ` Zhang Rui
  1 sibling, 0 replies; 5+ messages in thread
From: Javi Merino @ 2014-03-24 17:45 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Zhang Rui, Len Brown, Rafael J. Wysocki, Corentin Chary,
	Matthew Garrett, Sujith Thomas, Eduardo Valentin, linux-acpi,
	linux-kernel, acpi4asus-user, platform-driver-x86, linux-pm,
	Joe Perches

On Mon, Mar 24, 2014 at 05:29:09PM +0000, Rasmus Villemoes wrote:
> The macros KELVIN_TO_CELSIUS and CELSIUS_TO_KELVIN actually work on
> decikelvins, so rename them to reflect their actual semantics.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/acpi/thermal.c              | 12 ++++++------
>  drivers/platform/x86/asus-wmi.c     |  2 +-
>  drivers/platform/x86/intel_menlow.c |  8 ++++----
>  include/linux/thermal.h             |  6 +++---
>  4 files changed, 14 insertions(+), 14 deletions(-)

[snip]

> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index f7e11c7..c978aa3 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -41,9 +41,9 @@
>  #define THERMAL_NO_LIMIT	THERMAL_CSTATE_INVALID
>  
>  /* Unit conversion macros */
> -#define KELVIN_TO_CELSIUS(t)	(long)(((long)t-2732 >= 0) ?	\
> -				((long)t-2732+5)/10 : ((long)t-2732-5)/10)
> -#define CELSIUS_TO_KELVIN(t)	((t)*10+2732)
> +#define DECI_KELVIN_TO_CELSIUS(t)	(long)(((long)t-2732 >= 0) ?	\
> +					((long)t-2732+5)/10 : ((long)t-2732-5)/10)
> +#define CELSIUS_TO_DECI_KELVIN(t)	((t)*10+2732)

While you are at it, you could also make it use a statement expression
as Joe Perches suggested earlier:

http://thread.gmane.org/gmane.linux.power-management.general/43978/focus=1671955

Cheers,
Javi


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] linux/thermal.h: Rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS
@ 2014-03-24 17:29 Rasmus Villemoes
  2014-03-24 17:45 ` Javi Merino
  2014-04-03  2:42 ` Zhang Rui
  0 siblings, 2 replies; 5+ messages in thread
From: Rasmus Villemoes @ 2014-03-24 17:29 UTC (permalink / raw)
  To: Zhang Rui, Len Brown, Rafael J. Wysocki, Corentin Chary,
	Matthew Garrett, Sujith Thomas, Eduardo Valentin, linux-acpi,
	linux-kernel, acpi4asus-user, platform-driver-x86, linux-pm
  Cc: Rasmus Villemoes

The macros KELVIN_TO_CELSIUS and CELSIUS_TO_KELVIN actually work on
decikelvins, so rename them to reflect their actual semantics.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/acpi/thermal.c              | 12 ++++++------
 drivers/platform/x86/asus-wmi.c     |  2 +-
 drivers/platform/x86/intel_menlow.c |  8 ++++----
 include/linux/thermal.h             |  6 +++---
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 08626c8..3742e64 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -313,7 +313,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 			if (crt == -1) {
 				tz->trips.critical.flags.valid = 0;
 			} else if (crt > 0) {
-				unsigned long crt_k = CELSIUS_TO_KELVIN(crt);
+				unsigned long crt_k = CELSIUS_TO_DECI_KELVIN(crt);
 				/*
 				 * Allow override critical threshold
 				 */
@@ -349,7 +349,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 		if (psv == -1) {
 			status = AE_SUPPORT;
 		} else if (psv > 0) {
-			tmp = CELSIUS_TO_KELVIN(psv);
+			tmp = CELSIUS_TO_DECI_KELVIN(psv);
 			status = AE_OK;
 		} else {
 			status = acpi_evaluate_integer(tz->device->handle,
@@ -429,7 +429,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 					break;
 				if (i == 1)
 					tz->trips.active[0].temperature =
-						CELSIUS_TO_KELVIN(act);
+						CELSIUS_TO_DECI_KELVIN(act);
 				else
 					/*
 					 * Don't allow override higher than
@@ -437,9 +437,9 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 					 */
 					tz->trips.active[i - 1].temperature =
 						(tz->trips.active[i - 2].temperature <
-						CELSIUS_TO_KELVIN(act) ?
+						CELSIUS_TO_DECI_KELVIN(act) ?
 						tz->trips.active[i - 2].temperature :
-						CELSIUS_TO_KELVIN(act));
+						CELSIUS_TO_DECI_KELVIN(act));
 				break;
 			} else {
 				tz->trips.active[i].temperature = tmp;
@@ -1094,7 +1094,7 @@ static int acpi_thermal_add(struct acpi_device *device)
 		goto free_memory;
 
 	pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device),
-		acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature));
+		acpi_device_bid(device), DECI_KELVIN_TO_CELSIUS(tz->temperature));
 	goto end;
 
 free_memory:
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index c5e082f..2d81d5a 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1066,7 +1066,7 @@ static ssize_t asus_hwmon_temp1(struct device *dev,
 	if (err < 0)
 		return err;
 
-	value = KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000;
+	value = DECI_KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000;
 
 	return sprintf(buf, "%d\n", value);
 }
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c
index e8b46d2..0a919d8 100644
--- a/drivers/platform/x86/intel_menlow.c
+++ b/drivers/platform/x86/intel_menlow.c
@@ -315,7 +315,7 @@ static ssize_t aux0_show(struct device *dev,
 
 	result = sensor_get_auxtrip(attr->handle, 0, &value);
 
-	return result ? result : sprintf(buf, "%lu", KELVIN_TO_CELSIUS(value));
+	return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value));
 }
 
 static ssize_t aux1_show(struct device *dev,
@@ -327,7 +327,7 @@ static ssize_t aux1_show(struct device *dev,
 
 	result = sensor_get_auxtrip(attr->handle, 1, &value);
 
-	return result ? result : sprintf(buf, "%lu", KELVIN_TO_CELSIUS(value));
+	return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value));
 }
 
 static ssize_t aux0_store(struct device *dev,
@@ -345,7 +345,7 @@ static ssize_t aux0_store(struct device *dev,
 	if (value < 0)
 		return -EINVAL;
 
-	result = sensor_set_auxtrip(attr->handle, 0, CELSIUS_TO_KELVIN(value));
+	result = sensor_set_auxtrip(attr->handle, 0, CELSIUS_TO_DECI_KELVIN(value));
 	return result ? result : count;
 }
 
@@ -364,7 +364,7 @@ static ssize_t aux1_store(struct device *dev,
 	if (value < 0)
 		return -EINVAL;
 
-	result = sensor_set_auxtrip(attr->handle, 1, CELSIUS_TO_KELVIN(value));
+	result = sensor_set_auxtrip(attr->handle, 1, CELSIUS_TO_DECI_KELVIN(value));
 	return result ? result : count;
 }
 
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index f7e11c7..c978aa3 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -41,9 +41,9 @@
 #define THERMAL_NO_LIMIT	THERMAL_CSTATE_INVALID
 
 /* Unit conversion macros */
-#define KELVIN_TO_CELSIUS(t)	(long)(((long)t-2732 >= 0) ?	\
-				((long)t-2732+5)/10 : ((long)t-2732-5)/10)
-#define CELSIUS_TO_KELVIN(t)	((t)*10+2732)
+#define DECI_KELVIN_TO_CELSIUS(t)	(long)(((long)t-2732 >= 0) ?	\
+					((long)t-2732+5)/10 : ((long)t-2732-5)/10)
+#define CELSIUS_TO_DECI_KELVIN(t)	((t)*10+2732)
 
 /* Adding event notification support elements */
 #define THERMAL_GENL_FAMILY_NAME                "thermal_event"
-- 
1.8.4.rc3.2.g61bff3f


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-06 22:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01 21:45 [PATCH] linux/thermal.h: rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS Rasmus Villemoes
2015-10-06 22:30 ` Darren Hart
  -- strict thread matches above, loose matches on Subject: below --
2014-03-24 17:29 [PATCH] linux/thermal.h: Rename " Rasmus Villemoes
2014-03-24 17:45 ` Javi Merino
2014-04-03  2:42 ` Zhang Rui

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).