mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
linux/thermal.h: rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS
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> Acked-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
This commit is contained in:
parent
a71544cd93
commit
e866a2e395
4 changed files with 16 additions and 14 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue