]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
thermal: Fix cdev registration with THERMAL_NO_LIMIT on 64bit
authorPunit Agrawal <punit.agrawal@arm.com>
Tue, 9 Dec 2014 12:22:01 +0000 (12:22 +0000)
committerEduardo Valentin <edubezval@gmail.com>
Wed, 10 Dec 2014 15:11:00 +0000 (11:11 -0400)
The size of unsigned long varies between 32 and 64 bit systems while
the size of phandle arguments is always 32 bits per parameter.

On 64-bit systems, cooling devices registered via of-thermal apis fail
to bind when the min/max cooling state is specified as
THERMAL_NO_LIMIT (-1UL) as there is a mis-match between the value read
from the device tree (32bit) and the pre-processor define (64bit).

As we're unlikely to need cooling states larger than 32 bits, and for
consistency with the size of phandle arguments, explicitly limit
THERMAL_NO_LIMIT to 32 bits.

Reported-by: Hyungwoo Yang <hwoo.yang@gmail.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
include/dt-bindings/thermal/thermal.h
include/linux/thermal.h

index 59822a9958581dc5a1871ec3bc02c756656a836e..b5e6b0069ac7703b927a0c040ffcbd764c1afd89 100644 (file)
@@ -11,7 +11,7 @@
 #define _DT_BINDINGS_THERMAL_THERMAL_H
 
 /* On cooling devices upper and lower limits */
-#define THERMAL_NO_LIMIT               (-1UL)
+#define THERMAL_NO_LIMIT               (~0)
 
 #endif
 
index ef90838b36a072eeed278789c9bbe625fabe32f1..005586fdf82dbca1d2957601d84833b4560076e6 100644 (file)
@@ -38,7 +38,7 @@
 #define THERMAL_CSTATE_INVALID -1UL
 
 /* No upper/lower limit requirement */
-#define THERMAL_NO_LIMIT       THERMAL_CSTATE_INVALID
+#define THERMAL_NO_LIMIT       ((u32)~0)
 
 /* Unit conversion macros */
 #define KELVIN_TO_CELSIUS(t)   (long)(((long)t-2732 >= 0) ?    \