@@ -230,48 +230,6 @@ static void release_idr(struct idr *idr, struct mutex *lock, int id)
230230 mutex_unlock (lock );
231231}
232232
233- int get_tz_trend (struct thermal_zone_device * tz , int trip )
234- {
235- enum thermal_trend trend ;
236-
237- if (tz -> emul_temperature || !tz -> ops -> get_trend ||
238- tz -> ops -> get_trend (tz , trip , & trend )) {
239- if (tz -> temperature > tz -> last_temperature )
240- trend = THERMAL_TREND_RAISING ;
241- else if (tz -> temperature < tz -> last_temperature )
242- trend = THERMAL_TREND_DROPPING ;
243- else
244- trend = THERMAL_TREND_STABLE ;
245- }
246-
247- return trend ;
248- }
249- EXPORT_SYMBOL (get_tz_trend );
250-
251- struct thermal_instance *
252- get_thermal_instance (struct thermal_zone_device * tz ,
253- struct thermal_cooling_device * cdev , int trip )
254- {
255- struct thermal_instance * pos = NULL ;
256- struct thermal_instance * target_instance = NULL ;
257-
258- mutex_lock (& tz -> lock );
259- mutex_lock (& cdev -> lock );
260-
261- list_for_each_entry (pos , & tz -> thermal_instances , tz_node ) {
262- if (pos -> tz == tz && pos -> trip == trip && pos -> cdev == cdev ) {
263- target_instance = pos ;
264- break ;
265- }
266- }
267-
268- mutex_unlock (& cdev -> lock );
269- mutex_unlock (& tz -> lock );
270-
271- return target_instance ;
272- }
273- EXPORT_SYMBOL (get_thermal_instance );
274-
275233static void print_bind_err_msg (struct thermal_zone_device * tz ,
276234 struct thermal_cooling_device * cdev , int ret )
277235{
@@ -472,105 +430,6 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
472430 monitor_thermal_zone (tz );
473431}
474432
475- /**
476- * thermal_zone_get_temp() - returns the temperature of a thermal zone
477- * @tz: a valid pointer to a struct thermal_zone_device
478- * @temp: a valid pointer to where to store the resulting temperature.
479- *
480- * When a valid thermal zone reference is passed, it will fetch its
481- * temperature and fill @temp.
482- *
483- * Return: On success returns 0, an error code otherwise
484- */
485- int thermal_zone_get_temp (struct thermal_zone_device * tz , int * temp )
486- {
487- int ret = - EINVAL ;
488- int count ;
489- int crit_temp = INT_MAX ;
490- enum thermal_trip_type type ;
491-
492- if (!tz || IS_ERR (tz ) || !tz -> ops -> get_temp )
493- goto exit ;
494-
495- mutex_lock (& tz -> lock );
496-
497- ret = tz -> ops -> get_temp (tz , temp );
498-
499- if (IS_ENABLED (CONFIG_THERMAL_EMULATION ) && tz -> emul_temperature ) {
500- for (count = 0 ; count < tz -> trips ; count ++ ) {
501- ret = tz -> ops -> get_trip_type (tz , count , & type );
502- if (!ret && type == THERMAL_TRIP_CRITICAL ) {
503- ret = tz -> ops -> get_trip_temp (tz , count ,
504- & crit_temp );
505- break ;
506- }
507- }
508-
509- /*
510- * Only allow emulating a temperature when the real temperature
511- * is below the critical temperature so that the emulation code
512- * cannot hide critical conditions.
513- */
514- if (!ret && * temp < crit_temp )
515- * temp = tz -> emul_temperature ;
516- }
517-
518- mutex_unlock (& tz -> lock );
519- exit :
520- return ret ;
521- }
522- EXPORT_SYMBOL_GPL (thermal_zone_get_temp );
523-
524- void thermal_zone_set_trips (struct thermal_zone_device * tz )
525- {
526- int low = - INT_MAX ;
527- int high = INT_MAX ;
528- int trip_temp , hysteresis ;
529- int i , ret ;
530-
531- mutex_lock (& tz -> lock );
532-
533- if (!tz -> ops -> set_trips || !tz -> ops -> get_trip_hyst )
534- goto exit ;
535-
536- for (i = 0 ; i < tz -> trips ; i ++ ) {
537- int trip_low ;
538-
539- tz -> ops -> get_trip_temp (tz , i , & trip_temp );
540- tz -> ops -> get_trip_hyst (tz , i , & hysteresis );
541-
542- trip_low = trip_temp - hysteresis ;
543-
544- if (trip_low < tz -> temperature && trip_low > low )
545- low = trip_low ;
546-
547- if (trip_temp > tz -> temperature && trip_temp < high )
548- high = trip_temp ;
549- }
550-
551- /* No need to change trip points */
552- if (tz -> prev_low_trip == low && tz -> prev_high_trip == high )
553- goto exit ;
554-
555- tz -> prev_low_trip = low ;
556- tz -> prev_high_trip = high ;
557-
558- dev_dbg (& tz -> device ,
559- "new temperature boundaries: %d < x < %d\n" , low , high );
560-
561- /*
562- * Set a temperature window. When this window is left the driver
563- * must inform the thermal core via thermal_zone_device_update.
564- */
565- ret = tz -> ops -> set_trips (tz , low , high );
566- if (ret )
567- dev_err (& tz -> device , "Failed to set trips: %d\n" , ret );
568-
569- exit :
570- mutex_unlock (& tz -> lock );
571- }
572- EXPORT_SYMBOL_GPL (thermal_zone_set_trips );
573-
574433static void update_temperature (struct thermal_zone_device * tz )
575434{
576435 int temp , ret ;
@@ -1178,35 +1037,6 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
11781037}
11791038EXPORT_SYMBOL_GPL (thermal_cooling_device_unregister );
11801039
1181- void thermal_cdev_update (struct thermal_cooling_device * cdev )
1182- {
1183- struct thermal_instance * instance ;
1184- unsigned long target = 0 ;
1185-
1186- mutex_lock (& cdev -> lock );
1187- /* cooling device is updated*/
1188- if (cdev -> updated ) {
1189- mutex_unlock (& cdev -> lock );
1190- return ;
1191- }
1192-
1193- /* Make sure cdev enters the deepest cooling state */
1194- list_for_each_entry (instance , & cdev -> thermal_instances , cdev_node ) {
1195- dev_dbg (& cdev -> device , "zone%d->target=%lu\n" ,
1196- instance -> tz -> id , instance -> target );
1197- if (instance -> target == THERMAL_NO_TARGET )
1198- continue ;
1199- if (instance -> target > target )
1200- target = instance -> target ;
1201- }
1202- cdev -> ops -> set_cur_state (cdev , target );
1203- cdev -> updated = true;
1204- mutex_unlock (& cdev -> lock );
1205- trace_cdev_update (cdev , target );
1206- dev_dbg (& cdev -> device , "set to state %lu\n" , target );
1207- }
1208- EXPORT_SYMBOL (thermal_cdev_update );
1209-
12101040/**
12111041 * thermal_notify_framework - Sensor drivers use this API to notify framework
12121042 * @tz: thermal zone device
0 commit comments