@@ -118,12 +118,7 @@ static int of_thermal_set_trips(struct thermal_zone_device *tz,
118
118
*/
119
119
int of_thermal_get_ntrips (struct thermal_zone_device * tz )
120
120
{
121
- struct __thermal_zone * data = tz -> devdata ;
122
-
123
- if (!data || IS_ERR (data ))
124
- return - ENODEV ;
125
-
126
- return data -> ntrips ;
121
+ return tz -> num_trips ;
127
122
}
128
123
EXPORT_SYMBOL_GPL (of_thermal_get_ntrips );
129
124
@@ -139,9 +134,7 @@ EXPORT_SYMBOL_GPL(of_thermal_get_ntrips);
139
134
*/
140
135
bool of_thermal_is_trip_valid (struct thermal_zone_device * tz , int trip )
141
136
{
142
- struct __thermal_zone * data = tz -> devdata ;
143
-
144
- if (!data || trip >= data -> ntrips || trip < 0 )
137
+ if (trip >= tz -> num_trips || trip < 0 )
145
138
return false;
146
139
147
140
return true;
@@ -161,12 +154,7 @@ EXPORT_SYMBOL_GPL(of_thermal_is_trip_valid);
161
154
const struct thermal_trip *
162
155
of_thermal_get_trip_points (struct thermal_zone_device * tz )
163
156
{
164
- struct __thermal_zone * data = tz -> devdata ;
165
-
166
- if (!data )
167
- return NULL ;
168
-
169
- return data -> trips ;
157
+ return tz -> trips ;
170
158
}
171
159
EXPORT_SYMBOL_GPL (of_thermal_get_trip_points );
172
160
@@ -281,25 +269,21 @@ static int of_thermal_unbind(struct thermal_zone_device *thermal,
281
269
static int of_thermal_get_trip_type (struct thermal_zone_device * tz , int trip ,
282
270
enum thermal_trip_type * type )
283
271
{
284
- struct __thermal_zone * data = tz -> devdata ;
285
-
286
- if (trip >= data -> ntrips || trip < 0 )
272
+ if (trip >= tz -> num_trips || trip < 0 )
287
273
return - EDOM ;
288
274
289
- * type = data -> trips [trip ].type ;
275
+ * type = tz -> trips [trip ].type ;
290
276
291
277
return 0 ;
292
278
}
293
279
294
280
static int of_thermal_get_trip_temp (struct thermal_zone_device * tz , int trip ,
295
281
int * temp )
296
282
{
297
- struct __thermal_zone * data = tz -> devdata ;
298
-
299
- if (trip >= data -> ntrips || trip < 0 )
283
+ if (trip >= tz -> num_trips || trip < 0 )
300
284
return - EDOM ;
301
285
302
- * temp = data -> trips [trip ].temperature ;
286
+ * temp = tz -> trips [trip ].temperature ;
303
287
304
288
return 0 ;
305
289
}
@@ -309,7 +293,7 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
309
293
{
310
294
struct __thermal_zone * data = tz -> devdata ;
311
295
312
- if (trip >= data -> ntrips || trip < 0 )
296
+ if (trip >= tz -> num_trips || trip < 0 )
313
297
return - EDOM ;
314
298
315
299
if (data -> ops && data -> ops -> set_trip_temp ) {
@@ -321,47 +305,42 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
321
305
}
322
306
323
307
/* thermal framework should take care of data->mask & (1 << trip) */
324
- data -> trips [trip ].temperature = temp ;
308
+ tz -> trips [trip ].temperature = temp ;
325
309
326
310
return 0 ;
327
311
}
328
312
329
313
static int of_thermal_get_trip_hyst (struct thermal_zone_device * tz , int trip ,
330
314
int * hyst )
331
315
{
332
- struct __thermal_zone * data = tz -> devdata ;
333
-
334
- if (trip >= data -> ntrips || trip < 0 )
316
+ if (trip >= tz -> num_trips || trip < 0 )
335
317
return - EDOM ;
336
318
337
- * hyst = data -> trips [trip ].hysteresis ;
319
+ * hyst = tz -> trips [trip ].hysteresis ;
338
320
339
321
return 0 ;
340
322
}
341
323
342
324
static int of_thermal_set_trip_hyst (struct thermal_zone_device * tz , int trip ,
343
325
int hyst )
344
326
{
345
- struct __thermal_zone * data = tz -> devdata ;
346
-
347
- if (trip >= data -> ntrips || trip < 0 )
327
+ if (trip >= tz -> num_trips || trip < 0 )
348
328
return - EDOM ;
349
329
350
330
/* thermal framework should take care of data->mask & (1 << trip) */
351
- data -> trips [trip ].hysteresis = hyst ;
331
+ tz -> trips [trip ].hysteresis = hyst ;
352
332
353
333
return 0 ;
354
334
}
355
335
356
336
static int of_thermal_get_crit_temp (struct thermal_zone_device * tz ,
357
337
int * temp )
358
338
{
359
- struct __thermal_zone * data = tz -> devdata ;
360
339
int i ;
361
340
362
- for (i = 0 ; i < data -> ntrips ; i ++ )
363
- if (data -> trips [i ].type == THERMAL_TRIP_CRITICAL ) {
364
- * temp = data -> trips [i ].temperature ;
341
+ for (i = 0 ; i < tz -> num_trips ; i ++ )
342
+ if (tz -> trips [i ].type == THERMAL_TRIP_CRITICAL ) {
343
+ * temp = tz -> trips [i ].temperature ;
365
344
return 0 ;
366
345
}
367
346
0 commit comments