Re: [PATCH] linux/thermal.h: Rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS

From: Javi Merino
Date: Mon Mar 24 2014 - 13:45:53 EST


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@xxxxxxxxxxxxxxxxxx>
> ---
> 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/