aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/thermal.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/thermal.h')
-rw-r--r--include/linux/thermal.h8
1 files changed, 5 insertions, 3 deletions
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 @@
44#define THERMAL_WEIGHT_DEFAULT 0 44#define THERMAL_WEIGHT_DEFAULT 0
45 45
46/* Unit conversion macros */ 46/* Unit conversion macros */
47#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ 47#define DECI_KELVIN_TO_CELSIUS(t) ({ \
48 ((long)t-2732+5)/10 : ((long)t-2732-5)/10) 48 long _t = (t); \
49#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) 49 ((_t-2732 >= 0) ? (_t-2732+5)/10 : (_t-2732-5)/10); \
50})
51#define CELSIUS_TO_DECI_KELVIN(t) ((t)*10+2732)
50#define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100) 52#define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100)
51#define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732) 53#define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732)
52#define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off)) 54#define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off))