Skip to content

Commit b263b47

Browse files
KeerthyjEduardo Valentin
authored andcommitted
thermal: ti-soc-thermal: Remove redundant code
ti_thermal_expose_sensor always takes the devm_thermal_zone_of_sensor_register call for registration with the device tree nodes present for all the bandgap sensors for omap3/4/5 and dra7 family. There are large chunks of unused code. Removing all of them. Signed-off-by: Keerthy <[email protected]> Signed-off-by: Eduardo Valentin <[email protected]>
1 parent 004f772 commit b263b47

File tree

1 file changed

+3
-151
lines changed

1 file changed

+3
-151
lines changed

drivers/thermal/ti-soc-thermal/ti-thermal-common.c

Lines changed: 3 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -126,119 +126,6 @@ static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
126126
return __ti_thermal_get_temp(data, temp);
127127
}
128128

129-
/* Bind callback functions for thermal zone */
130-
static int ti_thermal_bind(struct thermal_zone_device *thermal,
131-
struct thermal_cooling_device *cdev)
132-
{
133-
struct ti_thermal_data *data = thermal->devdata;
134-
int id;
135-
136-
if (!data || IS_ERR(data))
137-
return -ENODEV;
138-
139-
/* check if this is the cooling device we registered */
140-
if (data->cool_dev != cdev)
141-
return 0;
142-
143-
id = data->sensor_id;
144-
145-
/* Simple thing, two trips, one passive another critical */
146-
return thermal_zone_bind_cooling_device(thermal, 0, cdev,
147-
/* bind with min and max states defined by cpu_cooling */
148-
THERMAL_NO_LIMIT,
149-
THERMAL_NO_LIMIT,
150-
THERMAL_WEIGHT_DEFAULT);
151-
}
152-
153-
/* Unbind callback functions for thermal zone */
154-
static int ti_thermal_unbind(struct thermal_zone_device *thermal,
155-
struct thermal_cooling_device *cdev)
156-
{
157-
struct ti_thermal_data *data = thermal->devdata;
158-
159-
if (!data || IS_ERR(data))
160-
return -ENODEV;
161-
162-
/* check if this is the cooling device we registered */
163-
if (data->cool_dev != cdev)
164-
return 0;
165-
166-
/* Simple thing, two trips, one passive another critical */
167-
return thermal_zone_unbind_cooling_device(thermal, 0, cdev);
168-
}
169-
170-
/* Get mode callback functions for thermal zone */
171-
static int ti_thermal_get_mode(struct thermal_zone_device *thermal,
172-
enum thermal_device_mode *mode)
173-
{
174-
struct ti_thermal_data *data = thermal->devdata;
175-
176-
if (data)
177-
*mode = data->mode;
178-
179-
return 0;
180-
}
181-
182-
/* Set mode callback functions for thermal zone */
183-
static int ti_thermal_set_mode(struct thermal_zone_device *thermal,
184-
enum thermal_device_mode mode)
185-
{
186-
struct ti_thermal_data *data = thermal->devdata;
187-
struct ti_bandgap *bgp;
188-
189-
bgp = data->bgp;
190-
191-
if (!data->ti_thermal) {
192-
dev_notice(&thermal->device, "thermal zone not registered\n");
193-
return 0;
194-
}
195-
196-
mutex_lock(&data->ti_thermal->lock);
197-
198-
if (mode == THERMAL_DEVICE_ENABLED)
199-
data->ti_thermal->polling_delay = FAST_TEMP_MONITORING_RATE;
200-
else
201-
data->ti_thermal->polling_delay = 0;
202-
203-
mutex_unlock(&data->ti_thermal->lock);
204-
205-
data->mode = mode;
206-
ti_bandgap_write_update_interval(bgp, data->sensor_id,
207-
data->ti_thermal->polling_delay);
208-
thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED);
209-
dev_dbg(&thermal->device, "thermal polling set for duration=%d msec\n",
210-
data->ti_thermal->polling_delay);
211-
212-
return 0;
213-
}
214-
215-
/* Get trip type callback functions for thermal zone */
216-
static int ti_thermal_get_trip_type(struct thermal_zone_device *thermal,
217-
int trip, enum thermal_trip_type *type)
218-
{
219-
if (!ti_thermal_is_valid_trip(trip))
220-
return -EINVAL;
221-
222-
if (trip + 1 == OMAP_TRIP_NUMBER)
223-
*type = THERMAL_TRIP_CRITICAL;
224-
else
225-
*type = THERMAL_TRIP_PASSIVE;
226-
227-
return 0;
228-
}
229-
230-
/* Get trip temperature callback functions for thermal zone */
231-
static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal,
232-
int trip, int *temp)
233-
{
234-
if (!ti_thermal_is_valid_trip(trip))
235-
return -EINVAL;
236-
237-
*temp = ti_thermal_get_trip_value(trip);
238-
239-
return 0;
240-
}
241-
242129
static int __ti_thermal_get_trend(void *p, int trip, enum thermal_trend *trend)
243130
{
244131
struct ti_thermal_data *data = p;
@@ -262,38 +149,11 @@ static int __ti_thermal_get_trend(void *p, int trip, enum thermal_trend *trend)
262149
return 0;
263150
}
264151

265-
/* Get the temperature trend callback functions for thermal zone */
266-
static int ti_thermal_get_trend(struct thermal_zone_device *thermal,
267-
int trip, enum thermal_trend *trend)
268-
{
269-
return __ti_thermal_get_trend(thermal->devdata, trip, trend);
270-
}
271-
272-
/* Get critical temperature callback functions for thermal zone */
273-
static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal,
274-
int *temp)
275-
{
276-
/* shutdown zone */
277-
return ti_thermal_get_trip_temp(thermal, OMAP_TRIP_NUMBER - 1, temp);
278-
}
279-
280152
static const struct thermal_zone_of_device_ops ti_of_thermal_ops = {
281153
.get_temp = __ti_thermal_get_temp,
282154
.get_trend = __ti_thermal_get_trend,
283155
};
284156

285-
static struct thermal_zone_device_ops ti_thermal_ops = {
286-
.get_temp = ti_thermal_get_temp,
287-
.get_trend = ti_thermal_get_trend,
288-
.bind = ti_thermal_bind,
289-
.unbind = ti_thermal_unbind,
290-
.get_mode = ti_thermal_get_mode,
291-
.set_mode = ti_thermal_set_mode,
292-
.get_trip_type = ti_thermal_get_trip_type,
293-
.get_trip_temp = ti_thermal_get_trip_temp,
294-
.get_crit_temp = ti_thermal_get_crit_temp,
295-
};
296-
297157
static struct ti_thermal_data
298158
*ti_thermal_build_data(struct ti_bandgap *bgp, int id)
299159
{
@@ -331,18 +191,10 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
331191
data->ti_thermal = devm_thermal_zone_of_sensor_register(bgp->dev, id,
332192
data, &ti_of_thermal_ops);
333193
if (IS_ERR(data->ti_thermal)) {
334-
/* Create thermal zone */
335-
data->ti_thermal = thermal_zone_device_register(domain,
336-
OMAP_TRIP_NUMBER, 0, data, &ti_thermal_ops,
337-
NULL, FAST_TEMP_MONITORING_RATE,
338-
FAST_TEMP_MONITORING_RATE);
339-
if (IS_ERR(data->ti_thermal)) {
340-
dev_err(bgp->dev, "thermal zone device is NULL\n");
341-
return PTR_ERR(data->ti_thermal);
342-
}
343-
data->ti_thermal->polling_delay = FAST_TEMP_MONITORING_RATE;
344-
data->our_zone = true;
194+
dev_err(bgp->dev, "thermal zone device is NULL\n");
195+
return PTR_ERR(data->ti_thermal);
345196
}
197+
346198
ti_bandgap_set_sensor_data(bgp, id, data);
347199
ti_bandgap_write_update_interval(bgp, data->sensor_id,
348200
data->ti_thermal->polling_delay);

0 commit comments

Comments
 (0)