1 From 5da86f6a2b4c2c318e153649dc8fd34fe73f8292 Mon Sep 17 00:00:00 2001
2 From: Sascha Hauer <s.hauer@pengutronix.de>
3 Date: Wed, 13 May 2015 10:52:35 +0200
4 Subject: [PATCH 16/76] thermal: streamline get_trend callbacks
6 The .get_trend callback in struct thermal_zone_device_ops has the prototype:
8 int (*get_trend) (struct thermal_zone_device *, int,
11 whereas the .get_trend callback in struct thermal_zone_of_device_ops has:
13 int (*get_trend)(void *, long *);
15 Streamline both prototypes and add the trip argument to the OF callback
16 aswell and use enum thermal_trend * instead of an integer pointer.
18 While the OF prototype may be the better one, this should be decided at
19 framework level and not on OF level.
21 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
23 drivers/thermal/of-thermal.c | 11 +--------
24 drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 25 +++++++-------------
25 include/linux/thermal.h | 2 +-
26 3 files changed, 10 insertions(+), 28 deletions(-)
28 --- a/drivers/thermal/of-thermal.c
29 +++ b/drivers/thermal/of-thermal.c
30 @@ -187,24 +187,15 @@ static int of_thermal_get_trend(struct t
31 enum thermal_trend *trend)
33 struct __thermal_zone *data = tz->devdata;
37 if (!data->ops->get_trend)
40 - r = data->ops->get_trend(data->sensor_data, &dev_trend);
41 + r = data->ops->get_trend(data->sensor_data, trip, trend);
45 - /* TODO: These intervals might have some thresholds, but in core code */
47 - *trend = THERMAL_TREND_RAISING;
48 - else if (dev_trend < 0)
49 - *trend = THERMAL_TREND_DROPPING;
51 - *trend = THERMAL_TREND_STABLE;
56 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
57 +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
58 @@ -238,7 +238,7 @@ static int ti_thermal_get_trip_temp(stru
62 -static int __ti_thermal_get_trend(void *p, long *trend)
63 +static int __ti_thermal_get_trend(void *p, int trip, enum thermal_trend *trend)
65 struct ti_thermal_data *data = p;
66 struct ti_bandgap *bgp;
67 @@ -251,22 +251,6 @@ static int __ti_thermal_get_trend(void *
76 -/* Get the temperature trend callback functions for thermal zone */
77 -static int ti_thermal_get_trend(struct thermal_zone_device *thermal,
78 - int trip, enum thermal_trend *trend)
83 - ret = __ti_thermal_get_trend(thermal->devdata, &tr);
88 *trend = THERMAL_TREND_RAISING;
90 @@ -277,6 +261,13 @@ static int ti_thermal_get_trend(struct t
94 +/* Get the temperature trend callback functions for thermal zone */
95 +static int ti_thermal_get_trend(struct thermal_zone_device *thermal,
96 + int trip, enum thermal_trend *trend)
98 + return __ti_thermal_get_trend(thermal->devdata, trip, trend);
101 /* Get critical temperature callback functions for thermal zone */
102 static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal,
104 --- a/include/linux/thermal.h
105 +++ b/include/linux/thermal.h
106 @@ -274,7 +274,7 @@ struct thermal_genl_event {
108 struct thermal_zone_of_device_ops {
109 int (*get_temp)(void *, int *);
110 - int (*get_trend)(void *, long *);
111 + int (*get_trend)(void *, int, enum thermal_trend *);
112 int (*set_emul_temp)(void *, int);