1 From 29e6031548373b9e7ec0c17e85da6a4cf4fee7f5 Mon Sep 17 00:00:00 2001
2 From: Sascha Hauer <s.hauer@pengutronix.de>
3 Date: Wed, 13 May 2015 10:52:29 +0200
4 Subject: [PATCH 10/76] thermal: consistently use int for temperatures
6 The thermal code uses int, long and unsigned long for temperatures
7 in different places. Using an unsigned type limits the thermal framework
8 to positive temperatures without need. 'long' is 64bit on several
9 architectures which is not needed. Consistently use a plain 'int'
12 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
14 drivers/acpi/thermal.c | 12 ++++-----
15 drivers/hwmon/lm75.c | 2 +-
16 drivers/hwmon/ntc_thermistor.c | 2 +-
17 drivers/hwmon/tmp102.c | 2 +-
18 drivers/input/touchscreen/sun4i-ts.c | 8 +++---
19 drivers/platform/x86/acerhdf.c | 9 +++----
20 drivers/power/power_supply_core.c | 2 +-
21 drivers/thermal/armada_thermal.c | 2 +-
22 drivers/thermal/db8500_thermal.c | 7 +++--
23 drivers/thermal/dove_thermal.c | 2 +-
24 drivers/thermal/fair_share.c | 2 +-
25 drivers/thermal/gov_bang_bang.c | 5 ++--
26 drivers/thermal/imx_thermal.c | 27 ++++++++++----------
27 .../thermal/int340x_thermal/int340x_thermal_zone.c | 10 ++++----
28 .../thermal/int340x_thermal/int340x_thermal_zone.h | 8 +++---
29 drivers/thermal/intel_soc_dts_thermal.c | 7 +++--
30 drivers/thermal/of-thermal.c | 14 +++++-----
31 drivers/thermal/rcar_thermal.c | 7 +++--
32 drivers/thermal/rockchip_thermal.c | 10 ++++----
33 drivers/thermal/samsung/exynos_tmu.c | 19 +++++++-------
34 drivers/thermal/spear_thermal.c | 2 +-
35 drivers/thermal/st/st_thermal.c | 5 ++--
36 drivers/thermal/step_wise.c | 4 +--
37 drivers/thermal/tegra_soctherm.c | 4 +--
38 drivers/thermal/thermal_core.c | 26 +++++++++----------
39 drivers/thermal/thermal_hwmon.c | 10 ++++----
40 drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 10 ++++----
41 drivers/thermal/x86_pkg_temp_thermal.c | 10 ++++----
42 include/linux/thermal.h | 26 ++++++++-----------
43 29 files changed, 120 insertions(+), 134 deletions(-)
45 diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
46 index d24fa19..68bff60 100644
47 --- a/drivers/acpi/thermal.c
48 +++ b/drivers/acpi/thermal.c
49 @@ -529,8 +529,7 @@ static void acpi_thermal_check(void *data)
51 /* sys I/F for generic thermal sysfs support */
53 -static int thermal_get_temp(struct thermal_zone_device *thermal,
54 - unsigned long *temp)
55 +static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
57 struct acpi_thermal *tz = thermal->devdata;
59 @@ -637,7 +636,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
62 static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
63 - int trip, unsigned long *temp)
64 + int trip, int *temp)
66 struct acpi_thermal *tz = thermal->devdata;
68 @@ -690,7 +689,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
71 static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
72 - unsigned long *temperature) {
75 struct acpi_thermal *tz = thermal->devdata;
77 if (tz->trips.critical.flags.valid) {
78 @@ -713,8 +713,8 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
81 if (type == THERMAL_TRIP_ACTIVE) {
82 - unsigned long trip_temp;
83 - unsigned long temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
85 + int temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
86 tz->temperature, tz->kelvin_offset);
87 if (thermal_get_trip_temp(thermal, trip, &trip_temp))
89 diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
90 index fe41d5a..e4e57bb 100644
91 --- a/drivers/hwmon/lm75.c
92 +++ b/drivers/hwmon/lm75.c
93 @@ -104,7 +104,7 @@ static inline long lm75_reg_to_mc(s16 temp, u8 resolution)
95 /* sysfs attributes for hwmon */
97 -static int lm75_read_temp(void *dev, long *temp)
98 +static int lm75_read_temp(void *dev, int *temp)
100 struct lm75_data *data = lm75_update_device(dev);
102 diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
103 index 6880011..3d9eab9 100644
104 --- a/drivers/hwmon/ntc_thermistor.c
105 +++ b/drivers/hwmon/ntc_thermistor.c
106 @@ -439,7 +439,7 @@ static int ntc_thermistor_get_ohm(struct ntc_data *data)
110 -static int ntc_read_temp(void *dev, long *temp)
111 +static int ntc_read_temp(void *dev, int *temp)
113 struct ntc_data *data = dev_get_drvdata(dev);
115 diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
116 index 9da2735..6548262 100644
117 --- a/drivers/hwmon/tmp102.c
118 +++ b/drivers/hwmon/tmp102.c
119 @@ -98,7 +98,7 @@ static struct tmp102 *tmp102_update_device(struct device *dev)
123 -static int tmp102_read_temp(void *dev, long *temp)
124 +static int tmp102_read_temp(void *dev, int *temp)
126 struct tmp102 *tmp102 = tmp102_update_device(dev);
128 diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
129 index c011699..4857943 100644
130 --- a/drivers/input/touchscreen/sun4i-ts.c
131 +++ b/drivers/input/touchscreen/sun4i-ts.c
132 @@ -191,7 +191,7 @@ static void sun4i_ts_close(struct input_dev *dev)
133 writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
136 -static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp)
137 +static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)
139 /* No temp_data until the first irq */
140 if (ts->temp_data == -1)
141 @@ -202,7 +202,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp)
145 -static int sun4i_get_tz_temp(void *data, long *temp)
146 +static int sun4i_get_tz_temp(void *data, int *temp)
148 return sun4i_get_temp(data, temp);
150 @@ -215,14 +215,14 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
153 struct sun4i_ts_data *ts = dev_get_drvdata(dev);
158 error = sun4i_get_temp(ts, &temp);
162 - return sprintf(buf, "%ld\n", temp);
163 + return sprintf(buf, "%d\n", temp);
166 static ssize_t show_temp_label(struct device *dev,
167 diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
168 index 594c918..f2ce63c 100644
169 --- a/drivers/platform/x86/acerhdf.c
170 +++ b/drivers/platform/x86/acerhdf.c
171 @@ -346,8 +346,7 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal)
172 * as late as the polling interval is since we can't do that in the respective
173 * accessors of the module parameters.
175 -static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal,
177 +static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal, int *t)
181 @@ -452,7 +451,7 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
184 static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
185 - unsigned long *temp)
190 @@ -463,7 +462,7 @@ static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
193 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
194 - unsigned long *temp)
199 @@ -476,7 +475,7 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
202 static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal,
203 - unsigned long *temperature)
206 *temperature = ACERHDF_TEMP_CRIT;
208 diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
209 index 2ed4a4a..87e2fd1 100644
210 --- a/drivers/power/power_supply_core.c
211 +++ b/drivers/power/power_supply_core.c
212 @@ -492,7 +492,7 @@ EXPORT_SYMBOL_GPL(power_supply_unreg_notifier);
214 #ifdef CONFIG_THERMAL
215 static int power_supply_read_temp(struct thermal_zone_device *tzd,
216 - unsigned long *temp)
219 struct power_supply *psy;
220 union power_supply_propval val;
221 diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
222 index 01255fd..26b8d32 100644
223 --- a/drivers/thermal/armada_thermal.c
224 +++ b/drivers/thermal/armada_thermal.c
225 @@ -155,7 +155,7 @@ static bool armada_is_valid(struct armada_thermal_priv *priv)
228 static int armada_get_temp(struct thermal_zone_device *thermal,
229 - unsigned long *temp)
232 struct armada_thermal_priv *priv = thermal->devdata;
234 diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
235 index 20adfbe..b3eca71 100644
236 --- a/drivers/thermal/db8500_thermal.c
237 +++ b/drivers/thermal/db8500_thermal.c
238 @@ -107,8 +107,7 @@ static int db8500_cdev_unbind(struct thermal_zone_device *thermal,
241 /* Callback to get current temperature */
242 -static int db8500_sys_get_temp(struct thermal_zone_device *thermal,
243 - unsigned long *temp)
244 +static int db8500_sys_get_temp(struct thermal_zone_device *thermal, int *temp)
246 struct db8500_thermal_zone *pzone = thermal->devdata;
248 @@ -180,7 +179,7 @@ static int db8500_sys_get_trip_type(struct thermal_zone_device *thermal,
250 /* Callback to get trip point temperature */
251 static int db8500_sys_get_trip_temp(struct thermal_zone_device *thermal,
252 - int trip, unsigned long *temp)
253 + int trip, int *temp)
255 struct db8500_thermal_zone *pzone = thermal->devdata;
256 struct db8500_thsens_platform_data *ptrips = pzone->trip_tab;
257 @@ -195,7 +194,7 @@ static int db8500_sys_get_trip_temp(struct thermal_zone_device *thermal,
259 /* Callback to get critical trip point temperature */
260 static int db8500_sys_get_crit_temp(struct thermal_zone_device *thermal,
261 - unsigned long *temp)
264 struct db8500_thermal_zone *pzone = thermal->devdata;
265 struct db8500_thsens_platform_data *ptrips = pzone->trip_tab;
266 diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
267 index 09f6e30..a0bc9de 100644
268 --- a/drivers/thermal/dove_thermal.c
269 +++ b/drivers/thermal/dove_thermal.c
270 @@ -93,7 +93,7 @@ static int dove_init_sensor(const struct dove_thermal_priv *priv)
273 static int dove_get_temp(struct thermal_zone_device *thermal,
274 - unsigned long *temp)
278 struct dove_thermal_priv *priv = thermal->devdata;
279 diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/fair_share.c
280 index 6e0a3fb..efad70e 100644
281 --- a/drivers/thermal/fair_share.c
282 +++ b/drivers/thermal/fair_share.c
284 static int get_trip_level(struct thermal_zone_device *tz)
287 - unsigned long trip_temp;
289 enum thermal_trip_type trip_type;
291 if (tz->trips == 0 || !tz->ops->get_trip_temp)
292 diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
293 index c5dd76b..70836c5 100644
294 --- a/drivers/thermal/gov_bang_bang.c
295 +++ b/drivers/thermal/gov_bang_bang.c
298 static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
301 - unsigned long trip_hyst;
302 + int trip_temp, trip_hyst;
303 struct thermal_instance *instance;
305 tz->ops->get_trip_temp(tz, trip, &trip_temp);
306 tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
308 - dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n",
309 + dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n",
310 trip, trip_temp, tz->temperature,
313 diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
314 index 2ccbc07..f1424f0 100644
315 --- a/drivers/thermal/imx_thermal.c
316 +++ b/drivers/thermal/imx_thermal.c
317 @@ -98,10 +98,10 @@ struct imx_thermal_data {
318 enum thermal_device_mode mode;
319 struct regmap *tempmon;
320 u32 c1, c2; /* See formula in imx_get_sensor_data() */
321 - unsigned long temp_passive;
322 - unsigned long temp_critical;
323 - unsigned long alarm_temp;
324 - unsigned long last_temp;
331 struct clk *thermal_clk;
332 @@ -109,7 +109,7 @@ struct imx_thermal_data {
335 static void imx_set_panic_temp(struct imx_thermal_data *data,
336 - signed long panic_temp)
339 struct regmap *map = data->tempmon;
341 @@ -121,7 +121,7 @@ static void imx_set_panic_temp(struct imx_thermal_data *data,
344 static void imx_set_alarm_temp(struct imx_thermal_data *data,
345 - signed long alarm_temp)
348 struct regmap *map = data->tempmon;
350 @@ -133,7 +133,7 @@ static void imx_set_alarm_temp(struct imx_thermal_data *data,
351 TEMPSENSE0_ALARM_VALUE_SHIFT);
354 -static int imx_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
355 +static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
357 struct imx_thermal_data *data = tz->devdata;
358 struct regmap *map = data->tempmon;
359 @@ -189,13 +189,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
360 if (data->alarm_temp == data->temp_critical &&
361 *temp < data->temp_passive) {
362 imx_set_alarm_temp(data, data->temp_passive);
363 - dev_dbg(&tz->device, "thermal alarm off: T < %lu\n",
364 + dev_dbg(&tz->device, "thermal alarm off: T < %d\n",
365 data->alarm_temp / 1000);
369 if (*temp != data->last_temp) {
370 - dev_dbg(&tz->device, "millicelsius: %ld\n", *temp);
371 + dev_dbg(&tz->device, "millicelsius: %d\n", *temp);
372 data->last_temp = *temp;
375 @@ -262,8 +262,7 @@ static int imx_get_trip_type(struct thermal_zone_device *tz, int trip,
379 -static int imx_get_crit_temp(struct thermal_zone_device *tz,
380 - unsigned long *temp)
381 +static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp)
383 struct imx_thermal_data *data = tz->devdata;
385 @@ -272,7 +271,7 @@ static int imx_get_crit_temp(struct thermal_zone_device *tz,
388 static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip,
389 - unsigned long *temp)
392 struct imx_thermal_data *data = tz->devdata;
394 @@ -282,7 +281,7 @@ static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip,
397 static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
398 - unsigned long temp)
401 struct imx_thermal_data *data = tz->devdata;
403 @@ -433,7 +432,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev)
405 struct imx_thermal_data *data = dev;
407 - dev_dbg(&data->tz->device, "THERMAL ALARM: T > %lu\n",
408 + dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n",
409 data->alarm_temp / 1000);
411 thermal_zone_device_update(data->tz);
412 diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
413 index 1e25133..b9b2666 100644
414 --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
415 +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
417 #include "int340x_thermal_zone.h"
419 static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
420 - unsigned long *temp)
423 struct int34x_thermal_zone *d = zone->devdata;
424 unsigned long long tmp;
425 @@ -49,7 +49,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
428 static int int340x_thermal_get_trip_temp(struct thermal_zone_device *zone,
429 - int trip, unsigned long *temp)
430 + int trip, int *temp)
432 struct int34x_thermal_zone *d = zone->devdata;
434 @@ -114,7 +114,7 @@ static int int340x_thermal_get_trip_type(struct thermal_zone_device *zone,
437 static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
438 - int trip, unsigned long temp)
439 + int trip, int temp)
441 struct int34x_thermal_zone *d = zone->devdata;
443 @@ -136,7 +136,7 @@ static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
446 static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone,
447 - int trip, unsigned long *temp)
448 + int trip, int *temp)
450 struct int34x_thermal_zone *d = zone->devdata;
452 @@ -163,7 +163,7 @@ static struct thermal_zone_device_ops int340x_thermal_zone_ops = {
455 static int int340x_thermal_get_trip_config(acpi_handle handle, char *name,
456 - unsigned long *temp)
459 unsigned long long r;
461 diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.h b/drivers/thermal/int340x_thermal/int340x_thermal_zone.h
462 index 9f38ab7..aaadf72 100644
463 --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.h
464 +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.h
466 #define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10
469 - unsigned long temp;
474 @@ -31,11 +31,11 @@ struct int34x_thermal_zone {
475 struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT];
476 unsigned long *aux_trips;
478 - unsigned long psv_temp;
481 - unsigned long crt_temp;
484 - unsigned long hot_temp;
487 struct thermal_zone_device *zone;
488 struct thermal_zone_device_ops *override_ops;
489 diff --git a/drivers/thermal/intel_soc_dts_thermal.c b/drivers/thermal/intel_soc_dts_thermal.c
490 index 9013505..fd550b9 100644
491 --- a/drivers/thermal/intel_soc_dts_thermal.c
492 +++ b/drivers/thermal/intel_soc_dts_thermal.c
493 @@ -106,7 +106,7 @@ err_ret:
496 static int sys_get_trip_temp(struct thermal_zone_device *tzd,
497 - int trip, unsigned long *temp)
498 + int trip, int *temp)
502 @@ -224,7 +224,7 @@ err_restore_ptps:
505 static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
506 - unsigned long temp)
509 struct soc_sensor_entry *aux_entry = tzd->devdata;
511 @@ -250,8 +250,7 @@ static int sys_get_trip_type(struct thermal_zone_device *thermal,
515 -static int sys_get_curr_temp(struct thermal_zone_device *tzd,
516 - unsigned long *temp)
517 +static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
521 diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
522 index 668fb1b..03839df 100644
523 --- a/drivers/thermal/of-thermal.c
524 +++ b/drivers/thermal/of-thermal.c
525 @@ -87,7 +87,7 @@ struct __thermal_zone {
526 /*** DT thermal zone device callbacks ***/
528 static int of_thermal_get_temp(struct thermal_zone_device *tz,
529 - unsigned long *temp)
532 struct __thermal_zone *data = tz->devdata;
534 @@ -173,7 +173,7 @@ EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);
535 * Return: zero on success, error code otherwise
537 static int of_thermal_set_emul_temp(struct thermal_zone_device *tz,
538 - unsigned long temp)
541 struct __thermal_zone *data = tz->devdata;
543 @@ -306,7 +306,7 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip,
546 static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip,
547 - unsigned long *temp)
550 struct __thermal_zone *data = tz->devdata;
552 @@ -319,7 +319,7 @@ static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip,
555 static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
556 - unsigned long temp)
559 struct __thermal_zone *data = tz->devdata;
561 @@ -333,7 +333,7 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
564 static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip,
565 - unsigned long *hyst)
568 struct __thermal_zone *data = tz->devdata;
570 @@ -346,7 +346,7 @@ static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip,
573 static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip,
574 - unsigned long hyst)
577 struct __thermal_zone *data = tz->devdata;
579 @@ -360,7 +360,7 @@ static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip,
582 static int of_thermal_get_crit_temp(struct thermal_zone_device *tz,
583 - unsigned long *temp)
586 struct __thermal_zone *data = tz->devdata;
588 diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
589 index fe4e767..5d4ae7d 100644
590 --- a/drivers/thermal/rcar_thermal.c
591 +++ b/drivers/thermal/rcar_thermal.c
592 @@ -200,8 +200,7 @@ err_out_unlock:
596 -static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
597 - unsigned long *temp)
598 +static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
600 struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
602 @@ -235,7 +234,7 @@ static int rcar_thermal_get_trip_type(struct thermal_zone_device *zone,
605 static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone,
606 - int trip, unsigned long *temp)
607 + int trip, int *temp)
609 struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
610 struct device *dev = rcar_priv_to_dev(priv);
611 @@ -299,7 +298,7 @@ static void _rcar_thermal_irq_ctrl(struct rcar_thermal_priv *priv, int enable)
612 static void rcar_thermal_work(struct work_struct *work)
614 struct rcar_thermal_priv *priv;
615 - unsigned long cctemp, nctemp;
616 + int cctemp, nctemp;
618 priv = container_of(work, struct rcar_thermal_priv, work.work);
620 diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
621 index cd8f5f93..c89ffb2 100644
622 --- a/drivers/thermal/rockchip_thermal.c
623 +++ b/drivers/thermal/rockchip_thermal.c
624 @@ -64,7 +64,7 @@ struct rockchip_tsadc_chip {
625 void (*control)(void __iomem *reg, bool on);
627 /* Per-sensor methods */
628 - int (*get_temp)(int chn, void __iomem *reg, long *temp);
629 + int (*get_temp)(int chn, void __iomem *reg, int *temp);
630 void (*set_tshut_temp)(int chn, void __iomem *reg, long temp);
631 void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m);
633 @@ -191,7 +191,7 @@ static u32 rk_tsadcv2_temp_to_code(long temp)
637 -static long rk_tsadcv2_code_to_temp(u32 code)
638 +static int rk_tsadcv2_code_to_temp(u32 code)
640 unsigned int low = 0;
641 unsigned int high = ARRAY_SIZE(v2_code_table) - 1;
642 @@ -277,7 +277,7 @@ static void rk_tsadcv2_control(void __iomem *regs, bool enable)
643 writel_relaxed(val, regs + TSADCV2_AUTO_CON);
646 -static int rk_tsadcv2_get_temp(int chn, void __iomem *regs, long *temp)
647 +static int rk_tsadcv2_get_temp(int chn, void __iomem *regs, int *temp)
651 @@ -366,7 +366,7 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev)
655 -static int rockchip_thermal_get_temp(void *_sensor, long *out_temp)
656 +static int rockchip_thermal_get_temp(void *_sensor, int *out_temp)
658 struct rockchip_thermal_sensor *sensor = _sensor;
659 struct rockchip_thermal_data *thermal = sensor->thermal;
660 @@ -374,7 +374,7 @@ static int rockchip_thermal_get_temp(void *_sensor, long *out_temp)
663 retval = tsadc->get_temp(sensor->id, thermal->regs, out_temp);
664 - dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %ld, retval: %d\n",
665 + dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n",
666 sensor->id, *out_temp, retval);
669 diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
670 index 1d30b09..29eaf4d 100644
671 --- a/drivers/thermal/samsung/exynos_tmu.c
672 +++ b/drivers/thermal/samsung/exynos_tmu.c
673 @@ -181,8 +181,7 @@ struct exynos_tmu_data {
674 int (*tmu_initialize)(struct platform_device *pdev);
675 void (*tmu_control)(struct platform_device *pdev, bool on);
676 int (*tmu_read)(struct exynos_tmu_data *data);
677 - void (*tmu_set_emulation)(struct exynos_tmu_data *data,
678 - unsigned long temp);
679 + void (*tmu_set_emulation)(struct exynos_tmu_data *data, int temp);
680 void (*tmu_clear_irqs)(struct exynos_tmu_data *data);
683 @@ -190,7 +189,7 @@ static void exynos_report_trigger(struct exynos_tmu_data *p)
685 char data[10], *envp[] = { data, NULL };
686 struct thermal_zone_device *tz = p->tzd;
687 - unsigned long temp;
692 @@ -489,7 +488,7 @@ static int exynos5440_tmu_initialize(struct platform_device *pdev)
693 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
694 unsigned int trim_info = 0, con, rising_threshold;
695 int ret = 0, threshold_code;
696 - unsigned long crit_temp = 0;
700 * For exynos5440 soc triminfo value is swapped between TMU0 and
701 @@ -542,7 +541,7 @@ static int exynos7_tmu_initialize(struct platform_device *pdev)
702 unsigned int status, trim_info;
703 unsigned int rising_threshold = 0, falling_threshold = 0;
704 int ret = 0, threshold_code, i;
705 - unsigned long temp, temp_hist;
706 + int temp, temp_hist;
707 unsigned int reg_off, bit_off;
709 status = readb(data->base + EXYNOS_TMU_REG_STATUS);
710 @@ -713,7 +712,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
711 writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
714 -static int exynos_get_temp(void *p, long *temp)
715 +static int exynos_get_temp(void *p, int *temp)
717 struct exynos_tmu_data *data = p;
719 @@ -733,7 +732,7 @@ static int exynos_get_temp(void *p, long *temp)
721 #ifdef CONFIG_THERMAL_EMULATION
722 static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val,
723 - unsigned long temp)
728 @@ -763,7 +762,7 @@ static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val,
731 static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
732 - unsigned long temp)
737 @@ -781,7 +780,7 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
740 static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data,
741 - unsigned long temp)
746 @@ -790,7 +789,7 @@ static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data,
747 writel(val, data->base + EXYNOS5440_TMU_S0_7_DEBUG);
750 -static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp)
751 +static int exynos_tmu_set_emulation(void *drv_data, int temp)
753 struct exynos_tmu_data *data = drv_data;
755 diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
756 index bddb717..534dd91 100644
757 --- a/drivers/thermal/spear_thermal.c
758 +++ b/drivers/thermal/spear_thermal.c
759 @@ -38,7 +38,7 @@ struct spear_thermal_dev {
762 static inline int thermal_get_temp(struct thermal_zone_device *thermal,
763 - unsigned long *temp)
766 struct spear_thermal_dev *stdev = thermal->devdata;
768 diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c
769 index 76c515d..44cbba9 100644
770 --- a/drivers/thermal/st/st_thermal.c
771 +++ b/drivers/thermal/st/st_thermal.c
772 @@ -111,8 +111,7 @@ static int st_thermal_calibration(struct st_thermal_sensor *sensor)
775 /* Callback to get temperature from HW*/
776 -static int st_thermal_get_temp(struct thermal_zone_device *th,
777 - unsigned long *temperature)
778 +static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature)
780 struct st_thermal_sensor *sensor = th->devdata;
781 struct device *dev = sensor->dev;
782 @@ -159,7 +158,7 @@ static int st_thermal_get_trip_type(struct thermal_zone_device *th,
785 static int st_thermal_get_trip_temp(struct thermal_zone_device *th,
786 - int trip, unsigned long *temp)
787 + int trip, int *temp)
789 struct st_thermal_sensor *sensor = th->devdata;
790 struct device *dev = sensor->dev;
791 diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c
792 index 5a0f12d..2f9f708 100644
793 --- a/drivers/thermal/step_wise.c
794 +++ b/drivers/thermal/step_wise.c
795 @@ -113,7 +113,7 @@ static void update_passive_instance(struct thermal_zone_device *tz,
797 static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
801 enum thermal_trip_type trip_type;
802 enum thermal_trend trend;
803 struct thermal_instance *instance;
804 @@ -135,7 +135,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
805 trace_thermal_zone_trip(tz, trip, trip_type);
808 - dev_dbg(&tz->device, "Trip%d[type=%d,temp=%ld]:trend=%d,throttle=%d\n",
809 + dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n",
810 trip, trip_type, trip_temp, trend, throttle);
812 mutex_lock(&tz->lock);
813 diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c
814 index 9197fc0..74ea576 100644
815 --- a/drivers/thermal/tegra_soctherm.c
816 +++ b/drivers/thermal/tegra_soctherm.c
817 @@ -293,7 +293,7 @@ static int enable_tsensor(struct tegra_soctherm *tegra,
818 * H denotes an addition of 0.5 Celsius and N denotes negation
819 * of the final value.
821 -static long translate_temp(u16 val)
822 +static int translate_temp(u16 val)
826 @@ -306,7 +306,7 @@ static long translate_temp(u16 val)
830 -static int tegra_thermctl_get_temp(void *data, long *out_temp)
831 +static int tegra_thermctl_get_temp(void *data, int *out_temp)
833 struct tegra_thermctl_zone *zone = data;
835 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
836 index 4108db7..62cc82a 100644
837 --- a/drivers/thermal/thermal_core.c
838 +++ b/drivers/thermal/thermal_core.c
839 @@ -363,7 +363,7 @@ static void handle_non_critical_trips(struct thermal_zone_device *tz,
840 static void handle_critical_trips(struct thermal_zone_device *tz,
841 int trip, enum thermal_trip_type trip_type)
846 tz->ops->get_trip_temp(tz, trip, &trip_temp);
848 @@ -411,12 +411,12 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
850 * Return: On success returns 0, an error code otherwise
852 -int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
853 +int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
856 #ifdef CONFIG_THERMAL_EMULATION
858 - unsigned long crit_temp = -1UL;
859 + int crit_temp = INT_MAX;
860 enum thermal_trip_type type;
863 @@ -453,8 +453,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_temp);
865 static void update_temperature(struct thermal_zone_device *tz)
871 ret = thermal_zone_get_temp(tz, &temp);
873 @@ -514,15 +513,14 @@ static ssize_t
874 temp_show(struct device *dev, struct device_attribute *attr, char *buf)
876 struct thermal_zone_device *tz = to_thermal_zone(dev);
879 + int temperature, ret;
881 ret = thermal_zone_get_temp(tz, &temperature);
886 - return sprintf(buf, "%ld\n", temperature);
887 + return sprintf(buf, "%d\n", temperature);
891 @@ -626,7 +624,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr,
893 struct thermal_zone_device *tz = to_thermal_zone(dev);
898 if (!tz->ops->get_trip_temp)
900 @@ -639,7 +637,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr,
904 - return sprintf(buf, "%ld\n", temperature);
905 + return sprintf(buf, "%d\n", temperature);
909 @@ -648,7 +646,7 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
911 struct thermal_zone_device *tz = to_thermal_zone(dev);
913 - unsigned long temperature;
916 if (!tz->ops->set_trip_hyst)
918 @@ -656,7 +654,7 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
919 if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip))
922 - if (kstrtoul(buf, 10, &temperature))
923 + if (kstrtoint(buf, 10, &temperature))
927 @@ -675,7 +673,7 @@ trip_point_hyst_show(struct device *dev, struct device_attribute *attr,
929 struct thermal_zone_device *tz = to_thermal_zone(dev);
931 - unsigned long temperature;
934 if (!tz->ops->get_trip_hyst)
936 @@ -685,7 +683,7 @@ trip_point_hyst_show(struct device *dev, struct device_attribute *attr,
938 ret = tz->ops->get_trip_hyst(tz, trip, &temperature);
940 - return ret ? ret : sprintf(buf, "%ld\n", temperature);
941 + return ret ? ret : sprintf(buf, "%d\n", temperature);
945 diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
946 index 1967bee..06fd2ed9 100644
947 --- a/drivers/thermal/thermal_hwmon.c
948 +++ b/drivers/thermal/thermal_hwmon.c
949 @@ -69,7 +69,7 @@ static DEVICE_ATTR(name, 0444, name_show, NULL);
951 temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
956 struct thermal_hwmon_attr *hwmon_attr
957 = container_of(attr, struct thermal_hwmon_attr, attr);
958 @@ -83,7 +83,7 @@ temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
962 - return sprintf(buf, "%ld\n", temperature);
963 + return sprintf(buf, "%d\n", temperature);
967 @@ -95,14 +95,14 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf)
968 = container_of(hwmon_attr, struct thermal_hwmon_temp,
970 struct thermal_zone_device *tz = temp->tz;
975 ret = tz->ops->get_trip_temp(tz, 0, &temperature);
979 - return sprintf(buf, "%ld\n", temperature);
980 + return sprintf(buf, "%d\n", temperature);
984 @@ -142,7 +142,7 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon,
986 static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz)
988 - unsigned long temp;
990 return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp);
993 diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
994 index a38c175..d3a42bf 100644
995 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
996 +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
997 @@ -76,14 +76,14 @@ static inline int ti_thermal_hotspot_temperature(int t, int s, int c)
999 /* thermal zone ops */
1000 /* Get temperature callback function for thermal zone*/
1001 -static inline int __ti_thermal_get_temp(void *devdata, long *temp)
1002 +static inline int __ti_thermal_get_temp(void *devdata, int *temp)
1004 struct thermal_zone_device *pcb_tz = NULL;
1005 struct ti_thermal_data *data = devdata;
1006 struct ti_bandgap *bgp;
1007 const struct ti_temp_sensor *s;
1008 int ret, tmp, slope, constant;
1009 - unsigned long pcb_temp;
1014 @@ -119,7 +119,7 @@ static inline int __ti_thermal_get_temp(void *devdata, long *temp)
1017 static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
1018 - unsigned long *temp)
1021 struct ti_thermal_data *data = thermal->devdata;
1023 @@ -228,7 +228,7 @@ static int ti_thermal_get_trip_type(struct thermal_zone_device *thermal,
1025 /* Get trip temperature callback functions for thermal zone */
1026 static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal,
1027 - int trip, unsigned long *temp)
1028 + int trip, int *temp)
1030 if (!ti_thermal_is_valid_trip(trip))
1032 @@ -279,7 +279,7 @@ static int ti_thermal_get_trend(struct thermal_zone_device *thermal,
1034 /* Get critical temperature callback functions for thermal zone */
1035 static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal,
1036 - unsigned long *temp)
1040 return ti_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp);
1041 diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c
1042 index 9ea3d9d..054c6d45 100644
1043 --- a/drivers/thermal/x86_pkg_temp_thermal.c
1044 +++ b/drivers/thermal/x86_pkg_temp_thermal.c
1045 @@ -164,7 +164,7 @@ err_ret:
1049 -static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *temp)
1050 +static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
1053 struct phy_dev_entry *phy_dev_entry;
1054 @@ -175,7 +175,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *tem
1055 if (eax & 0x80000000) {
1056 *temp = phy_dev_entry->tj_max -
1057 ((eax >> 16) & 0x7f) * 1000;
1058 - pr_debug("sys_get_curr_temp %ld\n", *temp);
1059 + pr_debug("sys_get_curr_temp %d\n", *temp);
1063 @@ -183,7 +183,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *tem
1066 static int sys_get_trip_temp(struct thermal_zone_device *tzd,
1067 - int trip, unsigned long *temp)
1068 + int trip, int *temp)
1071 struct phy_dev_entry *phy_dev_entry;
1072 @@ -214,13 +214,13 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd,
1073 *temp = phy_dev_entry->tj_max - thres_reg_value * 1000;
1076 - pr_debug("sys_get_trip_temp %ld\n", *temp);
1077 + pr_debug("sys_get_trip_temp %d\n", *temp);
1082 static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
1083 - unsigned long temp)
1087 struct phy_dev_entry *phy_dev_entry;
1088 diff --git a/include/linux/thermal.h b/include/linux/thermal.h
1089 index 5eac316..e9f2863 100644
1090 --- a/include/linux/thermal.h
1091 +++ b/include/linux/thermal.h
1092 @@ -86,23 +86,19 @@ struct thermal_zone_device_ops {
1093 struct thermal_cooling_device *);
1094 int (*unbind) (struct thermal_zone_device *,
1095 struct thermal_cooling_device *);
1096 - int (*get_temp) (struct thermal_zone_device *, unsigned long *);
1097 + int (*get_temp) (struct thermal_zone_device *, int *);
1098 int (*get_mode) (struct thermal_zone_device *,
1099 enum thermal_device_mode *);
1100 int (*set_mode) (struct thermal_zone_device *,
1101 enum thermal_device_mode);
1102 int (*get_trip_type) (struct thermal_zone_device *, int,
1103 enum thermal_trip_type *);
1104 - int (*get_trip_temp) (struct thermal_zone_device *, int,
1106 - int (*set_trip_temp) (struct thermal_zone_device *, int,
1108 - int (*get_trip_hyst) (struct thermal_zone_device *, int,
1110 - int (*set_trip_hyst) (struct thermal_zone_device *, int,
1112 - int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
1113 - int (*set_emul_temp) (struct thermal_zone_device *, unsigned long);
1114 + int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
1115 + int (*set_trip_temp) (struct thermal_zone_device *, int, int);
1116 + int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
1117 + int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
1118 + int (*get_crit_temp) (struct thermal_zone_device *, int *);
1119 + int (*set_emul_temp) (struct thermal_zone_device *, int);
1120 int (*get_trend) (struct thermal_zone_device *, int,
1121 enum thermal_trend *);
1122 int (*notify) (struct thermal_zone_device *, int,
1123 @@ -272,9 +268,9 @@ struct thermal_genl_event {
1126 struct thermal_zone_of_device_ops {
1127 - int (*get_temp)(void *, long *);
1128 + int (*get_temp)(void *, int *);
1129 int (*get_trend)(void *, long *);
1130 - int (*set_emul_temp)(void *, unsigned long);
1131 + int (*set_emul_temp)(void *, int);
1135 @@ -335,7 +331,7 @@ thermal_of_cooling_device_register(struct device_node *np, char *, void *,
1136 const struct thermal_cooling_device_ops *);
1137 void thermal_cooling_device_unregister(struct thermal_cooling_device *);
1138 struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
1139 -int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp);
1140 +int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
1142 int get_tz_trend(struct thermal_zone_device *, int);
1143 struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
1144 @@ -378,7 +374,7 @@ static inline struct thermal_zone_device *thermal_zone_get_zone_by_name(
1146 { return ERR_PTR(-ENODEV); }
1147 static inline int thermal_zone_get_temp(
1148 - struct thermal_zone_device *tz, unsigned long *temp)
1149 + struct thermal_zone_device *tz, int *temp)
1151 static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)