summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorCaesar Wang <wxt@rock-chips.com>2015-11-08 23:48:58 -0500
committerEduardo Valentin <edubezval@gmail.com>2015-11-12 13:20:16 -0500
commit437df2172e8d63b21b748ba1f3ac574451a51440 (patch)
tree40391f0a32530445e2f67ec6e5dd9fa60eeb6f49 /drivers/thermal
parent020ba95dbbbe83073a9728e046b4512b40896197 (diff)
thermal: rockchip: consistently use int for temperatures
As Temperature is currently represented as int not long in the thermal framework since use int intead of unsigned long/long to represent temperature to avoid bogus overheat detection when negative temperature reported. Signed-off-by: Caesar Wang <wxt@rock-chips.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/rockchip_thermal.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 7c5b7845419b..73d47f8461a8 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -88,7 +88,7 @@ struct rockchip_tsadc_chip {
88 int chn_num; 88 int chn_num;
89 89
90 /* The hardware-controlled tshut property */ 90 /* The hardware-controlled tshut property */
91 long tshut_temp; 91 int tshut_temp;
92 enum tshut_mode tshut_mode; 92 enum tshut_mode tshut_mode;
93 enum tshut_polarity tshut_polarity; 93 enum tshut_polarity tshut_polarity;
94 94
@@ -101,7 +101,7 @@ struct rockchip_tsadc_chip {
101 int (*get_temp)(struct chip_tsadc_table table, 101 int (*get_temp)(struct chip_tsadc_table table,
102 int chn, void __iomem *reg, int *temp); 102 int chn, void __iomem *reg, int *temp);
103 void (*set_tshut_temp)(struct chip_tsadc_table table, 103 void (*set_tshut_temp)(struct chip_tsadc_table table,
104 int chn, void __iomem *reg, long temp); 104 int chn, void __iomem *reg, int temp);
105 void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m); 105 void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m);
106 106
107 /* Per-table methods */ 107 /* Per-table methods */
@@ -126,7 +126,7 @@ struct rockchip_thermal_data {
126 126
127 void __iomem *regs; 127 void __iomem *regs;
128 128
129 long tshut_temp; 129 int tshut_temp;
130 enum tshut_mode tshut_mode; 130 enum tshut_mode tshut_mode;
131 enum tshut_polarity tshut_polarity; 131 enum tshut_polarity tshut_polarity;
132}; 132};
@@ -160,7 +160,7 @@ struct rockchip_thermal_data {
160 160
161struct tsadc_table { 161struct tsadc_table {
162 u32 code; 162 u32 code;
163 long temp; 163 int temp;
164}; 164};
165 165
166static const struct tsadc_table v2_code_table[] = { 166static const struct tsadc_table v2_code_table[] = {
@@ -202,7 +202,7 @@ static const struct tsadc_table v2_code_table[] = {
202}; 202};
203 203
204static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table, 204static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table,
205 long temp) 205 int temp)
206{ 206{
207 int high, low, mid; 207 int high, low, mid;
208 208
@@ -356,7 +356,7 @@ static int rk_tsadcv2_get_temp(struct chip_tsadc_table table,
356} 356}
357 357
358static void rk_tsadcv2_tshut_temp(struct chip_tsadc_table table, 358static void rk_tsadcv2_tshut_temp(struct chip_tsadc_table table,
359 int chn, void __iomem *regs, long temp) 359 int chn, void __iomem *regs, int temp)
360{ 360{
361 u32 tshut_value, val; 361 u32 tshut_value, val;
362 362
@@ -469,7 +469,7 @@ static int rockchip_configure_from_dt(struct device *dev,
469 469
470 if (of_property_read_u32(np, "rockchip,hw-tshut-temp", &shut_temp)) { 470 if (of_property_read_u32(np, "rockchip,hw-tshut-temp", &shut_temp)) {
471 dev_warn(dev, 471 dev_warn(dev,
472 "Missing tshut temp property, using default %ld\n", 472 "Missing tshut temp property, using default %d\n",
473 thermal->chip->tshut_temp); 473 thermal->chip->tshut_temp);
474 thermal->tshut_temp = thermal->chip->tshut_temp; 474 thermal->tshut_temp = thermal->chip->tshut_temp;
475 } else { 475 } else {
@@ -477,7 +477,7 @@ static int rockchip_configure_from_dt(struct device *dev,
477 } 477 }
478 478
479 if (thermal->tshut_temp > INT_MAX) { 479 if (thermal->tshut_temp > INT_MAX) {
480 dev_err(dev, "Invalid tshut temperature specified: %ld\n", 480 dev_err(dev, "Invalid tshut temperature specified: %d\n",
481 thermal->tshut_temp); 481 thermal->tshut_temp);
482 return -ERANGE; 482 return -ERANGE;
483 } 483 }