diff mbox series

[2/8] ACPI: thermal: switch to use <linux/temperature.h> helpers

Message ID 1574604530-9024-3-git-send-email-akinobu.mita@gmail.com (mailing list archive)
State Superseded, archived
Headers show
Series add header file for kelvin to/from Celsius conversion helpers | expand

Commit Message

Akinobu Mita Nov. 24, 2019, 2:08 p.m. UTC
This switches the ACPI thermal zone driver to use celsius_to_deci_kelvin()
and deci_kelvin_to_celsius() in <linux/temperature.h> instead of helpers
in <linux/thermal.h>.

This is preparation for centralizing the kelvin to/from Celsius conversion
helpers in <linux/temprature.h>.

Cc: Sujith Thomas <sujith.thomas@intel.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Amit Kucheria <amit.kucheria@verdurent.com>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/acpi/thermal.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Guenter Roeck Nov. 24, 2019, 3:17 p.m. UTC | #1
On 11/24/19 6:08 AM, Akinobu Mita wrote:
> This switches the ACPI thermal zone driver to use celsius_to_deci_kelvin()
> and deci_kelvin_to_celsius() in <linux/temperature.h> instead of helpers
> in <linux/thermal.h>.
> 
> This is preparation for centralizing the kelvin to/from Celsius conversion
> helpers in <linux/temprature.h>.
> 
s/temprature/temperature/

Looks like this applies to all patches.

> Cc: Sujith Thomas <sujith.thomas@intel.com>
> Cc: Darren Hart <dvhart@infradead.org>
> Cc: Andy Shevchenko <andy@infradead.org>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Eduardo Valentin <edubezval@gmail.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Amit Kucheria <amit.kucheria@verdurent.com>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Keith Busch <kbusch@kernel.org>
> Cc: Jens Axboe <axboe@fb.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Sagi Grimberg <sagi@grimberg.me>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
>   drivers/acpi/thermal.c | 15 +++++++++------
>   1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index d831a61..bd9b6eb 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -297,7 +297,9 @@ 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_DECI_KELVIN(crt);
> +				unsigned long crt_k =
> +					celsius_to_deci_kelvin(crt);
> +

>   				/*
>   				 * Allow override critical threshold
>   				 */
> @@ -333,7 +335,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_DECI_KELVIN(psv);
> +			tmp = celsius_to_deci_kelvin(psv);
>   			status = AE_OK;
>   		} else {
>   			status = acpi_evaluate_integer(tz->device->handle,
> @@ -413,7 +415,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
>   					break;
>   				if (i == 1)
>   					tz->trips.active[0].temperature =
> -						CELSIUS_TO_DECI_KELVIN(act);
> +						celsius_to_deci_kelvin(act);
>   				else
>   					/*
>   					 * Don't allow override higher than
> @@ -421,9 +423,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_DECI_KELVIN(act) ?
> +						celsius_to_deci_kelvin(act) ?
>   						tz->trips.active[i - 2].temperature :
> -						CELSIUS_TO_DECI_KELVIN(act));
> +						celsius_to_deci_kelvin(act));
>   				break;
>   			} else {
>   				tz->trips.active[i].temperature = tmp;
> @@ -1087,7 +1089,8 @@ 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), DECI_KELVIN_TO_CELSIUS(tz->temperature));
> +		acpi_device_bid(device),
> +		deci_kelvin_to_celsius(tz->temperature));
>   	goto end;
>   
>   free_memory:
>
Akinobu Mita Nov. 25, 2019, 2:31 p.m. UTC | #2
2019年11月25日(月) 0:17 Guenter Roeck <linux@roeck-us.net>:
>
> On 11/24/19 6:08 AM, Akinobu Mita wrote:
> > This switches the ACPI thermal zone driver to use celsius_to_deci_kelvin()
> > and deci_kelvin_to_celsius() in <linux/temperature.h> instead of helpers
> > in <linux/thermal.h>.
> >
> > This is preparation for centralizing the kelvin to/from Celsius conversion
> > helpers in <linux/temprature.h>.
> >
> s/temprature/temperature/
>
> Looks like this applies to all patches.

Oops.  I'll fix in the next version.
diff mbox series

Patch

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index d831a61..bd9b6eb 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -297,7 +297,9 @@  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_DECI_KELVIN(crt);
+				unsigned long crt_k =
+					celsius_to_deci_kelvin(crt);
+
 				/*
 				 * Allow override critical threshold
 				 */
@@ -333,7 +335,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_DECI_KELVIN(psv);
+			tmp = celsius_to_deci_kelvin(psv);
 			status = AE_OK;
 		} else {
 			status = acpi_evaluate_integer(tz->device->handle,
@@ -413,7 +415,7 @@  static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 					break;
 				if (i == 1)
 					tz->trips.active[0].temperature =
-						CELSIUS_TO_DECI_KELVIN(act);
+						celsius_to_deci_kelvin(act);
 				else
 					/*
 					 * Don't allow override higher than
@@ -421,9 +423,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_DECI_KELVIN(act) ?
+						celsius_to_deci_kelvin(act) ?
 						tz->trips.active[i - 2].temperature :
-						CELSIUS_TO_DECI_KELVIN(act));
+						celsius_to_deci_kelvin(act));
 				break;
 			} else {
 				tz->trips.active[i].temperature = tmp;
@@ -1087,7 +1089,8 @@  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), DECI_KELVIN_TO_CELSIUS(tz->temperature));
+		acpi_device_bid(device),
+		deci_kelvin_to_celsius(tz->temperature));
 	goto end;
 
 free_memory: