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 --- a/drivers/acpi/thermal.c
46 +++ b/drivers/acpi/thermal.c
47 @@ -529,8 +529,7 @@ static void acpi_thermal_check(void *dat
49 /* sys I/F for generic thermal sysfs support */
51 -static int thermal_get_temp(struct thermal_zone_device *thermal,
52 - unsigned long *temp)
53 +static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
55 struct acpi_thermal *tz = thermal->devdata;
57 @@ -637,7 +636,7 @@ static int thermal_get_trip_type(struct
60 static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
61 - int trip, unsigned long *temp)
62 + int trip, int *temp)
64 struct acpi_thermal *tz = thermal->devdata;
66 @@ -690,7 +689,8 @@ static int thermal_get_trip_temp(struct
69 static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
70 - unsigned long *temperature) {
73 struct acpi_thermal *tz = thermal->devdata;
75 if (tz->trips.critical.flags.valid) {
76 @@ -713,8 +713,8 @@ static int thermal_get_trend(struct ther
79 if (type == THERMAL_TRIP_ACTIVE) {
80 - unsigned long trip_temp;
81 - unsigned long temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
83 + int temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
84 tz->temperature, tz->kelvin_offset);
85 if (thermal_get_trip_temp(thermal, trip, &trip_temp))
87 --- a/drivers/hwmon/lm75.c
88 +++ b/drivers/hwmon/lm75.c
89 @@ -104,7 +104,7 @@ static inline long lm75_reg_to_mc(s16 te
91 /* sysfs attributes for hwmon */
93 -static int lm75_read_temp(void *dev, long *temp)
94 +static int lm75_read_temp(void *dev, int *temp)
96 struct lm75_data *data = lm75_update_device(dev);
98 --- a/drivers/hwmon/ntc_thermistor.c
99 +++ b/drivers/hwmon/ntc_thermistor.c
100 @@ -439,7 +439,7 @@ static int ntc_thermistor_get_ohm(struct
104 -static int ntc_read_temp(void *dev, long *temp)
105 +static int ntc_read_temp(void *dev, int *temp)
107 struct ntc_data *data = dev_get_drvdata(dev);
109 --- a/drivers/hwmon/tmp102.c
110 +++ b/drivers/hwmon/tmp102.c
111 @@ -98,7 +98,7 @@ static struct tmp102 *tmp102_update_devi
115 -static int tmp102_read_temp(void *dev, long *temp)
116 +static int tmp102_read_temp(void *dev, int *temp)
118 struct tmp102 *tmp102 = tmp102_update_device(dev);
120 --- a/drivers/input/touchscreen/sun4i-ts.c
121 +++ b/drivers/input/touchscreen/sun4i-ts.c
122 @@ -191,7 +191,7 @@ static void sun4i_ts_close(struct input_
123 writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
126 -static int sun4i_get_temp(const struct sun4i_ts_data *ts, long *temp)
127 +static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)
129 /* No temp_data until the first irq */
130 if (ts->temp_data == -1)
131 @@ -202,7 +202,7 @@ static int sun4i_get_temp(const struct s
135 -static int sun4i_get_tz_temp(void *data, long *temp)
136 +static int sun4i_get_tz_temp(void *data, int *temp)
138 return sun4i_get_temp(data, temp);
140 @@ -215,14 +215,14 @@ static ssize_t show_temp(struct device *
143 struct sun4i_ts_data *ts = dev_get_drvdata(dev);
148 error = sun4i_get_temp(ts, &temp);
152 - return sprintf(buf, "%ld\n", temp);
153 + return sprintf(buf, "%d\n", temp);
156 static ssize_t show_temp_label(struct device *dev,
157 --- a/drivers/platform/x86/acerhdf.c
158 +++ b/drivers/platform/x86/acerhdf.c
159 @@ -346,8 +346,7 @@ static void acerhdf_check_param(struct t
160 * as late as the polling interval is since we can't do that in the respective
161 * accessors of the module parameters.
163 -static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal,
165 +static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal, int *t)
169 @@ -452,7 +451,7 @@ static int acerhdf_get_trip_type(struct
172 static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
173 - unsigned long *temp)
178 @@ -463,7 +462,7 @@ static int acerhdf_get_trip_hyst(struct
181 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
182 - unsigned long *temp)
187 @@ -476,7 +475,7 @@ static int acerhdf_get_trip_temp(struct
190 static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal,
191 - unsigned long *temperature)
194 *temperature = ACERHDF_TEMP_CRIT;
196 --- a/drivers/power/power_supply_core.c
197 +++ b/drivers/power/power_supply_core.c
198 @@ -518,7 +518,7 @@ EXPORT_SYMBOL_GPL(power_supply_unreg_not
200 #ifdef CONFIG_THERMAL
201 static int power_supply_read_temp(struct thermal_zone_device *tzd,
202 - unsigned long *temp)
205 struct power_supply *psy;
206 union power_supply_propval val;
207 --- a/drivers/thermal/armada_thermal.c
208 +++ b/drivers/thermal/armada_thermal.c
209 @@ -155,7 +155,7 @@ static bool armada_is_valid(struct armad
212 static int armada_get_temp(struct thermal_zone_device *thermal,
213 - unsigned long *temp)
216 struct armada_thermal_priv *priv = thermal->devdata;
218 --- a/drivers/thermal/db8500_thermal.c
219 +++ b/drivers/thermal/db8500_thermal.c
220 @@ -107,8 +107,7 @@ static int db8500_cdev_unbind(struct the
223 /* Callback to get current temperature */
224 -static int db8500_sys_get_temp(struct thermal_zone_device *thermal,
225 - unsigned long *temp)
226 +static int db8500_sys_get_temp(struct thermal_zone_device *thermal, int *temp)
228 struct db8500_thermal_zone *pzone = thermal->devdata;
230 @@ -180,7 +179,7 @@ static int db8500_sys_get_trip_type(stru
232 /* Callback to get trip point temperature */
233 static int db8500_sys_get_trip_temp(struct thermal_zone_device *thermal,
234 - int trip, unsigned long *temp)
235 + int trip, int *temp)
237 struct db8500_thermal_zone *pzone = thermal->devdata;
238 struct db8500_thsens_platform_data *ptrips = pzone->trip_tab;
239 @@ -195,7 +194,7 @@ static int db8500_sys_get_trip_temp(stru
241 /* Callback to get critical trip point temperature */
242 static int db8500_sys_get_crit_temp(struct thermal_zone_device *thermal,
243 - unsigned long *temp)
246 struct db8500_thermal_zone *pzone = thermal->devdata;
247 struct db8500_thsens_platform_data *ptrips = pzone->trip_tab;
248 --- a/drivers/thermal/dove_thermal.c
249 +++ b/drivers/thermal/dove_thermal.c
250 @@ -93,7 +93,7 @@ static int dove_init_sensor(const struct
253 static int dove_get_temp(struct thermal_zone_device *thermal,
254 - unsigned long *temp)
258 struct dove_thermal_priv *priv = thermal->devdata;
259 --- a/drivers/thermal/fair_share.c
260 +++ b/drivers/thermal/fair_share.c
262 static int get_trip_level(struct thermal_zone_device *tz)
265 - unsigned long trip_temp;
267 enum thermal_trip_type trip_type;
269 if (tz->trips == 0 || !tz->ops->get_trip_temp)
270 --- a/drivers/thermal/gov_bang_bang.c
271 +++ b/drivers/thermal/gov_bang_bang.c
274 static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
277 - unsigned long trip_hyst;
278 + int trip_temp, trip_hyst;
279 struct thermal_instance *instance;
281 tz->ops->get_trip_temp(tz, trip, &trip_temp);
282 tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
284 - dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n",
285 + dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n",
286 trip, trip_temp, tz->temperature,
289 --- a/drivers/thermal/imx_thermal.c
290 +++ b/drivers/thermal/imx_thermal.c
291 @@ -98,10 +98,10 @@ struct imx_thermal_data {
292 enum thermal_device_mode mode;
293 struct regmap *tempmon;
294 u32 c1, c2; /* See formula in imx_get_sensor_data() */
295 - unsigned long temp_passive;
296 - unsigned long temp_critical;
297 - unsigned long alarm_temp;
298 - unsigned long last_temp;
305 struct clk *thermal_clk;
306 @@ -109,7 +109,7 @@ struct imx_thermal_data {
309 static void imx_set_panic_temp(struct imx_thermal_data *data,
310 - signed long panic_temp)
313 struct regmap *map = data->tempmon;
315 @@ -121,7 +121,7 @@ static void imx_set_panic_temp(struct im
318 static void imx_set_alarm_temp(struct imx_thermal_data *data,
319 - signed long alarm_temp)
322 struct regmap *map = data->tempmon;
324 @@ -133,7 +133,7 @@ static void imx_set_alarm_temp(struct im
325 TEMPSENSE0_ALARM_VALUE_SHIFT);
328 -static int imx_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
329 +static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
331 struct imx_thermal_data *data = tz->devdata;
332 struct regmap *map = data->tempmon;
333 @@ -189,13 +189,13 @@ static int imx_get_temp(struct thermal_z
334 if (data->alarm_temp == data->temp_critical &&
335 *temp < data->temp_passive) {
336 imx_set_alarm_temp(data, data->temp_passive);
337 - dev_dbg(&tz->device, "thermal alarm off: T < %lu\n",
338 + dev_dbg(&tz->device, "thermal alarm off: T < %d\n",
339 data->alarm_temp / 1000);
343 if (*temp != data->last_temp) {
344 - dev_dbg(&tz->device, "millicelsius: %ld\n", *temp);
345 + dev_dbg(&tz->device, "millicelsius: %d\n", *temp);
346 data->last_temp = *temp;
349 @@ -262,8 +262,7 @@ static int imx_get_trip_type(struct ther
353 -static int imx_get_crit_temp(struct thermal_zone_device *tz,
354 - unsigned long *temp)
355 +static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp)
357 struct imx_thermal_data *data = tz->devdata;
359 @@ -272,7 +271,7 @@ static int imx_get_crit_temp(struct ther
362 static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip,
363 - unsigned long *temp)
366 struct imx_thermal_data *data = tz->devdata;
368 @@ -282,7 +281,7 @@ static int imx_get_trip_temp(struct ther
371 static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
372 - unsigned long temp)
375 struct imx_thermal_data *data = tz->devdata;
377 @@ -433,7 +432,7 @@ static irqreturn_t imx_thermal_alarm_irq
379 struct imx_thermal_data *data = dev;
381 - dev_dbg(&data->tz->device, "THERMAL ALARM: T > %lu\n",
382 + dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n",
383 data->alarm_temp / 1000);
385 thermal_zone_device_update(data->tz);
386 --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
387 +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
389 #include "int340x_thermal_zone.h"
391 static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
392 - unsigned long *temp)
395 struct int34x_thermal_zone *d = zone->devdata;
396 unsigned long long tmp;
397 @@ -49,7 +49,7 @@ static int int340x_thermal_get_zone_temp
400 static int int340x_thermal_get_trip_temp(struct thermal_zone_device *zone,
401 - int trip, unsigned long *temp)
402 + int trip, int *temp)
404 struct int34x_thermal_zone *d = zone->devdata;
406 @@ -114,7 +114,7 @@ static int int340x_thermal_get_trip_type
409 static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
410 - int trip, unsigned long temp)
411 + int trip, int temp)
413 struct int34x_thermal_zone *d = zone->devdata;
415 @@ -136,7 +136,7 @@ static int int340x_thermal_set_trip_temp
418 static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone,
419 - int trip, unsigned long *temp)
420 + int trip, int *temp)
422 struct int34x_thermal_zone *d = zone->devdata;
424 @@ -163,7 +163,7 @@ static struct thermal_zone_device_ops in
427 static int int340x_thermal_get_trip_config(acpi_handle handle, char *name,
428 - unsigned long *temp)
431 unsigned long long r;
433 --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.h
434 +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.h
436 #define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10
439 - unsigned long temp;
444 @@ -31,11 +31,11 @@ struct int34x_thermal_zone {
445 struct active_trip act_trips[INT340X_THERMAL_MAX_ACT_TRIP_COUNT];
446 unsigned long *aux_trips;
448 - unsigned long psv_temp;
451 - unsigned long crt_temp;
454 - unsigned long hot_temp;
457 struct thermal_zone_device *zone;
458 struct thermal_zone_device_ops *override_ops;
459 --- a/drivers/thermal/intel_soc_dts_thermal.c
460 +++ b/drivers/thermal/intel_soc_dts_thermal.c
461 @@ -106,7 +106,7 @@ err_ret:
464 static int sys_get_trip_temp(struct thermal_zone_device *tzd,
465 - int trip, unsigned long *temp)
466 + int trip, int *temp)
470 @@ -224,7 +224,7 @@ err_restore_ptps:
473 static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
474 - unsigned long temp)
477 struct soc_sensor_entry *aux_entry = tzd->devdata;
479 @@ -250,8 +250,7 @@ static int sys_get_trip_type(struct ther
483 -static int sys_get_curr_temp(struct thermal_zone_device *tzd,
484 - unsigned long *temp)
485 +static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
489 --- a/drivers/thermal/of-thermal.c
490 +++ b/drivers/thermal/of-thermal.c
491 @@ -87,7 +87,7 @@ struct __thermal_zone {
492 /*** DT thermal zone device callbacks ***/
494 static int of_thermal_get_temp(struct thermal_zone_device *tz,
495 - unsigned long *temp)
498 struct __thermal_zone *data = tz->devdata;
500 @@ -173,7 +173,7 @@ EXPORT_SYMBOL_GPL(of_thermal_get_trip_po
501 * Return: zero on success, error code otherwise
503 static int of_thermal_set_emul_temp(struct thermal_zone_device *tz,
504 - unsigned long temp)
507 struct __thermal_zone *data = tz->devdata;
509 @@ -306,7 +306,7 @@ static int of_thermal_get_trip_type(stru
512 static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip,
513 - unsigned long *temp)
516 struct __thermal_zone *data = tz->devdata;
518 @@ -319,7 +319,7 @@ static int of_thermal_get_trip_temp(stru
521 static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
522 - unsigned long temp)
525 struct __thermal_zone *data = tz->devdata;
527 @@ -333,7 +333,7 @@ static int of_thermal_set_trip_temp(stru
530 static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip,
531 - unsigned long *hyst)
534 struct __thermal_zone *data = tz->devdata;
536 @@ -346,7 +346,7 @@ static int of_thermal_get_trip_hyst(stru
539 static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip,
540 - unsigned long hyst)
543 struct __thermal_zone *data = tz->devdata;
545 @@ -360,7 +360,7 @@ static int of_thermal_set_trip_hyst(stru
548 static int of_thermal_get_crit_temp(struct thermal_zone_device *tz,
549 - unsigned long *temp)
552 struct __thermal_zone *data = tz->devdata;
554 --- a/drivers/thermal/rcar_thermal.c
555 +++ b/drivers/thermal/rcar_thermal.c
556 @@ -200,8 +200,7 @@ err_out_unlock:
560 -static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
561 - unsigned long *temp)
562 +static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
564 struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
566 @@ -235,7 +234,7 @@ static int rcar_thermal_get_trip_type(st
569 static int rcar_thermal_get_trip_temp(struct thermal_zone_device *zone,
570 - int trip, unsigned long *temp)
571 + int trip, int *temp)
573 struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
574 struct device *dev = rcar_priv_to_dev(priv);
575 @@ -299,7 +298,7 @@ static void _rcar_thermal_irq_ctrl(struc
576 static void rcar_thermal_work(struct work_struct *work)
578 struct rcar_thermal_priv *priv;
579 - unsigned long cctemp, nctemp;
580 + int cctemp, nctemp;
582 priv = container_of(work, struct rcar_thermal_priv, work.work);
584 --- a/drivers/thermal/rockchip_thermal.c
585 +++ b/drivers/thermal/rockchip_thermal.c
586 @@ -64,7 +64,7 @@ struct rockchip_tsadc_chip {
587 void (*control)(void __iomem *reg, bool on);
589 /* Per-sensor methods */
590 - int (*get_temp)(int chn, void __iomem *reg, long *temp);
591 + int (*get_temp)(int chn, void __iomem *reg, int *temp);
592 void (*set_tshut_temp)(int chn, void __iomem *reg, long temp);
593 void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m);
595 @@ -191,7 +191,7 @@ static u32 rk_tsadcv2_temp_to_code(long
599 -static long rk_tsadcv2_code_to_temp(u32 code)
600 +static int rk_tsadcv2_code_to_temp(u32 code)
602 unsigned int low = 0;
603 unsigned int high = ARRAY_SIZE(v2_code_table) - 1;
604 @@ -277,7 +277,7 @@ static void rk_tsadcv2_control(void __io
605 writel_relaxed(val, regs + TSADCV2_AUTO_CON);
608 -static int rk_tsadcv2_get_temp(int chn, void __iomem *regs, long *temp)
609 +static int rk_tsadcv2_get_temp(int chn, void __iomem *regs, int *temp)
613 @@ -366,7 +366,7 @@ static irqreturn_t rockchip_thermal_alar
617 -static int rockchip_thermal_get_temp(void *_sensor, long *out_temp)
618 +static int rockchip_thermal_get_temp(void *_sensor, int *out_temp)
620 struct rockchip_thermal_sensor *sensor = _sensor;
621 struct rockchip_thermal_data *thermal = sensor->thermal;
622 @@ -374,7 +374,7 @@ static int rockchip_thermal_get_temp(voi
625 retval = tsadc->get_temp(sensor->id, thermal->regs, out_temp);
626 - dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %ld, retval: %d\n",
627 + dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n",
628 sensor->id, *out_temp, retval);
631 --- a/drivers/thermal/samsung/exynos_tmu.c
632 +++ b/drivers/thermal/samsung/exynos_tmu.c
633 @@ -181,8 +181,7 @@ struct exynos_tmu_data {
634 int (*tmu_initialize)(struct platform_device *pdev);
635 void (*tmu_control)(struct platform_device *pdev, bool on);
636 int (*tmu_read)(struct exynos_tmu_data *data);
637 - void (*tmu_set_emulation)(struct exynos_tmu_data *data,
638 - unsigned long temp);
639 + void (*tmu_set_emulation)(struct exynos_tmu_data *data, int temp);
640 void (*tmu_clear_irqs)(struct exynos_tmu_data *data);
643 @@ -190,7 +189,7 @@ static void exynos_report_trigger(struct
645 char data[10], *envp[] = { data, NULL };
646 struct thermal_zone_device *tz = p->tzd;
647 - unsigned long temp;
652 @@ -489,7 +488,7 @@ static int exynos5440_tmu_initialize(str
653 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
654 unsigned int trim_info = 0, con, rising_threshold;
655 int ret = 0, threshold_code;
656 - unsigned long crit_temp = 0;
660 * For exynos5440 soc triminfo value is swapped between TMU0 and
661 @@ -542,7 +541,7 @@ static int exynos7_tmu_initialize(struct
662 unsigned int status, trim_info;
663 unsigned int rising_threshold = 0, falling_threshold = 0;
664 int ret = 0, threshold_code, i;
665 - unsigned long temp, temp_hist;
666 + int temp, temp_hist;
667 unsigned int reg_off, bit_off;
669 status = readb(data->base + EXYNOS_TMU_REG_STATUS);
670 @@ -713,7 +712,7 @@ static void exynos7_tmu_control(struct p
671 writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
674 -static int exynos_get_temp(void *p, long *temp)
675 +static int exynos_get_temp(void *p, int *temp)
677 struct exynos_tmu_data *data = p;
679 @@ -733,7 +732,7 @@ static int exynos_get_temp(void *p, long
681 #ifdef CONFIG_THERMAL_EMULATION
682 static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val,
683 - unsigned long temp)
688 @@ -763,7 +762,7 @@ static u32 get_emul_con_reg(struct exyno
691 static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
692 - unsigned long temp)
697 @@ -781,7 +780,7 @@ static void exynos4412_tmu_set_emulation
700 static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data,
701 - unsigned long temp)
706 @@ -790,7 +789,7 @@ static void exynos5440_tmu_set_emulation
707 writel(val, data->base + EXYNOS5440_TMU_S0_7_DEBUG);
710 -static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp)
711 +static int exynos_tmu_set_emulation(void *drv_data, int temp)
713 struct exynos_tmu_data *data = drv_data;
715 --- a/drivers/thermal/spear_thermal.c
716 +++ b/drivers/thermal/spear_thermal.c
717 @@ -38,7 +38,7 @@ struct spear_thermal_dev {
720 static inline int thermal_get_temp(struct thermal_zone_device *thermal,
721 - unsigned long *temp)
724 struct spear_thermal_dev *stdev = thermal->devdata;
726 --- a/drivers/thermal/st/st_thermal.c
727 +++ b/drivers/thermal/st/st_thermal.c
728 @@ -111,8 +111,7 @@ static int st_thermal_calibration(struct
731 /* Callback to get temperature from HW*/
732 -static int st_thermal_get_temp(struct thermal_zone_device *th,
733 - unsigned long *temperature)
734 +static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature)
736 struct st_thermal_sensor *sensor = th->devdata;
737 struct device *dev = sensor->dev;
738 @@ -159,7 +158,7 @@ static int st_thermal_get_trip_type(stru
741 static int st_thermal_get_trip_temp(struct thermal_zone_device *th,
742 - int trip, unsigned long *temp)
743 + int trip, int *temp)
745 struct st_thermal_sensor *sensor = th->devdata;
746 struct device *dev = sensor->dev;
747 --- a/drivers/thermal/step_wise.c
748 +++ b/drivers/thermal/step_wise.c
749 @@ -113,7 +113,7 @@ static void update_passive_instance(stru
751 static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
755 enum thermal_trip_type trip_type;
756 enum thermal_trend trend;
757 struct thermal_instance *instance;
758 @@ -135,7 +135,7 @@ static void thermal_zone_trip_update(str
759 trace_thermal_zone_trip(tz, trip, trip_type);
762 - dev_dbg(&tz->device, "Trip%d[type=%d,temp=%ld]:trend=%d,throttle=%d\n",
763 + dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n",
764 trip, trip_type, trip_temp, trend, throttle);
766 mutex_lock(&tz->lock);
767 --- a/drivers/thermal/tegra_soctherm.c
768 +++ b/drivers/thermal/tegra_soctherm.c
769 @@ -293,7 +293,7 @@ static int enable_tsensor(struct tegra_s
770 * H denotes an addition of 0.5 Celsius and N denotes negation
771 * of the final value.
773 -static long translate_temp(u16 val)
774 +static int translate_temp(u16 val)
778 @@ -306,7 +306,7 @@ static long translate_temp(u16 val)
782 -static int tegra_thermctl_get_temp(void *data, long *out_temp)
783 +static int tegra_thermctl_get_temp(void *data, int *out_temp)
785 struct tegra_thermctl_zone *zone = data;
787 --- a/drivers/thermal/thermal_core.c
788 +++ b/drivers/thermal/thermal_core.c
789 @@ -363,7 +363,7 @@ static void handle_non_critical_trips(st
790 static void handle_critical_trips(struct thermal_zone_device *tz,
791 int trip, enum thermal_trip_type trip_type)
796 tz->ops->get_trip_temp(tz, trip, &trip_temp);
798 @@ -411,12 +411,12 @@ static void handle_thermal_trip(struct t
800 * Return: On success returns 0, an error code otherwise
802 -int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
803 +int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
806 #ifdef CONFIG_THERMAL_EMULATION
808 - unsigned long crit_temp = -1UL;
809 + int crit_temp = INT_MAX;
810 enum thermal_trip_type type;
813 @@ -453,8 +453,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_temp)
815 static void update_temperature(struct thermal_zone_device *tz)
821 ret = thermal_zone_get_temp(tz, &temp);
823 @@ -514,15 +513,14 @@ static ssize_t
824 temp_show(struct device *dev, struct device_attribute *attr, char *buf)
826 struct thermal_zone_device *tz = to_thermal_zone(dev);
829 + int temperature, ret;
831 ret = thermal_zone_get_temp(tz, &temperature);
836 - return sprintf(buf, "%ld\n", temperature);
837 + return sprintf(buf, "%d\n", temperature);
841 @@ -626,7 +624,7 @@ trip_point_temp_show(struct device *dev,
843 struct thermal_zone_device *tz = to_thermal_zone(dev);
848 if (!tz->ops->get_trip_temp)
850 @@ -639,7 +637,7 @@ trip_point_temp_show(struct device *dev,
854 - return sprintf(buf, "%ld\n", temperature);
855 + return sprintf(buf, "%d\n", temperature);
859 @@ -648,7 +646,7 @@ trip_point_hyst_store(struct device *dev
861 struct thermal_zone_device *tz = to_thermal_zone(dev);
863 - unsigned long temperature;
866 if (!tz->ops->set_trip_hyst)
868 @@ -656,7 +654,7 @@ trip_point_hyst_store(struct device *dev
869 if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip))
872 - if (kstrtoul(buf, 10, &temperature))
873 + if (kstrtoint(buf, 10, &temperature))
877 @@ -675,7 +673,7 @@ trip_point_hyst_show(struct device *dev,
879 struct thermal_zone_device *tz = to_thermal_zone(dev);
881 - unsigned long temperature;
884 if (!tz->ops->get_trip_hyst)
886 @@ -685,7 +683,7 @@ trip_point_hyst_show(struct device *dev,
888 ret = tz->ops->get_trip_hyst(tz, trip, &temperature);
890 - return ret ? ret : sprintf(buf, "%ld\n", temperature);
891 + return ret ? ret : sprintf(buf, "%d\n", temperature);
895 --- a/drivers/thermal/thermal_hwmon.c
896 +++ b/drivers/thermal/thermal_hwmon.c
897 @@ -69,7 +69,7 @@ static DEVICE_ATTR(name, 0444, name_show
899 temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
904 struct thermal_hwmon_attr *hwmon_attr
905 = container_of(attr, struct thermal_hwmon_attr, attr);
906 @@ -83,7 +83,7 @@ temp_input_show(struct device *dev, stru
910 - return sprintf(buf, "%ld\n", temperature);
911 + return sprintf(buf, "%d\n", temperature);
915 @@ -95,14 +95,14 @@ temp_crit_show(struct device *dev, struc
916 = container_of(hwmon_attr, struct thermal_hwmon_temp,
918 struct thermal_zone_device *tz = temp->tz;
923 ret = tz->ops->get_trip_temp(tz, 0, &temperature);
927 - return sprintf(buf, "%ld\n", temperature);
928 + return sprintf(buf, "%d\n", temperature);
932 @@ -142,7 +142,7 @@ thermal_hwmon_lookup_temp(const struct t
934 static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz)
936 - unsigned long temp;
938 return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp);
941 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
942 +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
943 @@ -76,14 +76,14 @@ static inline int ti_thermal_hotspot_tem
945 /* thermal zone ops */
946 /* Get temperature callback function for thermal zone*/
947 -static inline int __ti_thermal_get_temp(void *devdata, long *temp)
948 +static inline int __ti_thermal_get_temp(void *devdata, int *temp)
950 struct thermal_zone_device *pcb_tz = NULL;
951 struct ti_thermal_data *data = devdata;
952 struct ti_bandgap *bgp;
953 const struct ti_temp_sensor *s;
954 int ret, tmp, slope, constant;
955 - unsigned long pcb_temp;
960 @@ -119,7 +119,7 @@ static inline int __ti_thermal_get_temp(
963 static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
964 - unsigned long *temp)
967 struct ti_thermal_data *data = thermal->devdata;
969 @@ -228,7 +228,7 @@ static int ti_thermal_get_trip_type(stru
971 /* Get trip temperature callback functions for thermal zone */
972 static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal,
973 - int trip, unsigned long *temp)
974 + int trip, int *temp)
976 if (!ti_thermal_is_valid_trip(trip))
978 @@ -279,7 +279,7 @@ static int ti_thermal_get_trend(struct t
980 /* Get critical temperature callback functions for thermal zone */
981 static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal,
982 - unsigned long *temp)
986 return ti_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp);
987 --- a/drivers/thermal/x86_pkg_temp_thermal.c
988 +++ b/drivers/thermal/x86_pkg_temp_thermal.c
989 @@ -164,7 +164,7 @@ err_ret:
993 -static int sys_get_curr_temp(struct thermal_zone_device *tzd, unsigned long *temp)
994 +static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
997 struct phy_dev_entry *phy_dev_entry;
998 @@ -175,7 +175,7 @@ static int sys_get_curr_temp(struct ther
999 if (eax & 0x80000000) {
1000 *temp = phy_dev_entry->tj_max -
1001 ((eax >> 16) & 0x7f) * 1000;
1002 - pr_debug("sys_get_curr_temp %ld\n", *temp);
1003 + pr_debug("sys_get_curr_temp %d\n", *temp);
1007 @@ -183,7 +183,7 @@ static int sys_get_curr_temp(struct ther
1010 static int sys_get_trip_temp(struct thermal_zone_device *tzd,
1011 - int trip, unsigned long *temp)
1012 + int trip, int *temp)
1015 struct phy_dev_entry *phy_dev_entry;
1016 @@ -214,13 +214,13 @@ static int sys_get_trip_temp(struct ther
1017 *temp = phy_dev_entry->tj_max - thres_reg_value * 1000;
1020 - pr_debug("sys_get_trip_temp %ld\n", *temp);
1021 + pr_debug("sys_get_trip_temp %d\n", *temp);
1026 static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
1027 - unsigned long temp)
1031 struct phy_dev_entry *phy_dev_entry;
1032 --- a/include/linux/thermal.h
1033 +++ b/include/linux/thermal.h
1034 @@ -86,23 +86,19 @@ struct thermal_zone_device_ops {
1035 struct thermal_cooling_device *);
1036 int (*unbind) (struct thermal_zone_device *,
1037 struct thermal_cooling_device *);
1038 - int (*get_temp) (struct thermal_zone_device *, unsigned long *);
1039 + int (*get_temp) (struct thermal_zone_device *, int *);
1040 int (*get_mode) (struct thermal_zone_device *,
1041 enum thermal_device_mode *);
1042 int (*set_mode) (struct thermal_zone_device *,
1043 enum thermal_device_mode);
1044 int (*get_trip_type) (struct thermal_zone_device *, int,
1045 enum thermal_trip_type *);
1046 - int (*get_trip_temp) (struct thermal_zone_device *, int,
1048 - int (*set_trip_temp) (struct thermal_zone_device *, int,
1050 - int (*get_trip_hyst) (struct thermal_zone_device *, int,
1052 - int (*set_trip_hyst) (struct thermal_zone_device *, int,
1054 - int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
1055 - int (*set_emul_temp) (struct thermal_zone_device *, unsigned long);
1056 + int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
1057 + int (*set_trip_temp) (struct thermal_zone_device *, int, int);
1058 + int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
1059 + int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
1060 + int (*get_crit_temp) (struct thermal_zone_device *, int *);
1061 + int (*set_emul_temp) (struct thermal_zone_device *, int);
1062 int (*get_trend) (struct thermal_zone_device *, int,
1063 enum thermal_trend *);
1064 int (*notify) (struct thermal_zone_device *, int,
1065 @@ -272,9 +268,9 @@ struct thermal_genl_event {
1068 struct thermal_zone_of_device_ops {
1069 - int (*get_temp)(void *, long *);
1070 + int (*get_temp)(void *, int *);
1071 int (*get_trend)(void *, long *);
1072 - int (*set_emul_temp)(void *, unsigned long);
1073 + int (*set_emul_temp)(void *, int);
1077 @@ -335,7 +331,7 @@ thermal_of_cooling_device_register(struc
1078 const struct thermal_cooling_device_ops *);
1079 void thermal_cooling_device_unregister(struct thermal_cooling_device *);
1080 struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
1081 -int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp);
1082 +int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
1084 int get_tz_trend(struct thermal_zone_device *, int);
1085 struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
1086 @@ -378,7 +374,7 @@ static inline struct thermal_zone_device
1088 { return ERR_PTR(-ENODEV); }
1089 static inline int thermal_zone_get_temp(
1090 - struct thermal_zone_device *tz, unsigned long *temp)
1091 + struct thermal_zone_device *tz, int *temp)
1093 static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)