@@ -97,11 +97,9 @@ struct power_allocator_params {
9797 struct power_actor * power ;
9898};
9999
100- static bool power_actor_is_valid (struct power_allocator_params * params ,
101- struct thermal_instance * instance )
100+ static bool power_actor_is_valid (struct thermal_instance * instance )
102101{
103- return (instance -> trip == params -> trip_max &&
104- cdev_is_power_actor (instance -> cdev ));
102+ return cdev_is_power_actor (instance -> cdev );
105103}
106104
107105/**
@@ -118,13 +116,14 @@ static bool power_actor_is_valid(struct power_allocator_params *params,
118116static u32 estimate_sustainable_power (struct thermal_zone_device * tz )
119117{
120118 struct power_allocator_params * params = tz -> governor_data ;
119+ const struct thermal_trip_desc * td = trip_to_trip_desc (params -> trip_max );
121120 struct thermal_cooling_device * cdev ;
122121 struct thermal_instance * instance ;
123122 u32 sustainable_power = 0 ;
124123 u32 min_power ;
125124
126- list_for_each_entry (instance , & tz -> thermal_instances , tz_node ) {
127- if (!power_actor_is_valid (params , instance ))
125+ list_for_each_entry (instance , & td -> thermal_instances , trip_node ) {
126+ if (!power_actor_is_valid (instance ))
128127 continue ;
129128
130129 cdev = instance -> cdev ;
@@ -400,6 +399,7 @@ static void divvy_up_power(struct power_actor *power, int num_actors,
400399static void allocate_power (struct thermal_zone_device * tz , int control_temp )
401400{
402401 struct power_allocator_params * params = tz -> governor_data ;
402+ const struct thermal_trip_desc * td = trip_to_trip_desc (params -> trip_max );
403403 unsigned int num_actors = params -> num_actors ;
404404 struct power_actor * power = params -> power ;
405405 struct thermal_cooling_device * cdev ;
@@ -417,10 +417,10 @@ static void allocate_power(struct thermal_zone_device *tz, int control_temp)
417417 /* Clean all buffers for new power estimations */
418418 memset (power , 0 , params -> buffer_size );
419419
420- list_for_each_entry (instance , & tz -> thermal_instances , tz_node ) {
420+ list_for_each_entry (instance , & td -> thermal_instances , trip_node ) {
421421 struct power_actor * pa = & power [i ];
422422
423- if (!power_actor_is_valid (params , instance ))
423+ if (!power_actor_is_valid (instance ))
424424 continue ;
425425
426426 cdev = instance -> cdev ;
@@ -454,10 +454,10 @@ static void allocate_power(struct thermal_zone_device *tz, int control_temp)
454454 power_range );
455455
456456 i = 0 ;
457- list_for_each_entry (instance , & tz -> thermal_instances , tz_node ) {
457+ list_for_each_entry (instance , & td -> thermal_instances , trip_node ) {
458458 struct power_actor * pa = & power [i ];
459459
460- if (!power_actor_is_valid (params , instance ))
460+ if (!power_actor_is_valid (instance ))
461461 continue ;
462462
463463 power_actor_set_power (instance -> cdev , instance ,
@@ -538,12 +538,13 @@ static void reset_pid_controller(struct power_allocator_params *params)
538538static void allow_maximum_power (struct thermal_zone_device * tz )
539539{
540540 struct power_allocator_params * params = tz -> governor_data ;
541+ const struct thermal_trip_desc * td = trip_to_trip_desc (params -> trip_max );
541542 struct thermal_cooling_device * cdev ;
542543 struct thermal_instance * instance ;
543544 u32 req_power ;
544545
545- list_for_each_entry (instance , & tz -> thermal_instances , tz_node ) {
546- if (!power_actor_is_valid (params , instance ))
546+ list_for_each_entry (instance , & td -> thermal_instances , trip_node ) {
547+ if (!power_actor_is_valid (instance ))
547548 continue ;
548549
549550 cdev = instance -> cdev ;
@@ -581,13 +582,11 @@ static void allow_maximum_power(struct thermal_zone_device *tz)
581582static int check_power_actors (struct thermal_zone_device * tz ,
582583 struct power_allocator_params * params )
583584{
585+ const struct thermal_trip_desc * td = trip_to_trip_desc (params -> trip_max );
584586 struct thermal_instance * instance ;
585587 int ret = 0 ;
586588
587- list_for_each_entry (instance , & tz -> thermal_instances , tz_node ) {
588- if (instance -> trip != params -> trip_max )
589- continue ;
590-
589+ list_for_each_entry (instance , & td -> thermal_instances , trip_node ) {
591590 if (!cdev_is_power_actor (instance -> cdev )) {
592591 dev_warn (& tz -> device , "power_allocator: %s is not a power actor\n" ,
593592 instance -> cdev -> type );
@@ -635,14 +634,15 @@ static void power_allocator_update_tz(struct thermal_zone_device *tz,
635634 enum thermal_notify_event reason )
636635{
637636 struct power_allocator_params * params = tz -> governor_data ;
637+ const struct thermal_trip_desc * td = trip_to_trip_desc (params -> trip_max );
638638 struct thermal_instance * instance ;
639639 int num_actors = 0 ;
640640
641641 switch (reason ) {
642642 case THERMAL_TZ_BIND_CDEV :
643643 case THERMAL_TZ_UNBIND_CDEV :
644- list_for_each_entry (instance , & tz -> thermal_instances , tz_node )
645- if (power_actor_is_valid (params , instance ))
644+ list_for_each_entry (instance , & td -> thermal_instances , trip_node )
645+ if (power_actor_is_valid (instance ))
646646 num_actors ++ ;
647647
648648 if (num_actors == params -> num_actors )
@@ -652,8 +652,8 @@ static void power_allocator_update_tz(struct thermal_zone_device *tz,
652652 break ;
653653 case THERMAL_INSTANCE_WEIGHT_CHANGED :
654654 params -> total_weight = 0 ;
655- list_for_each_entry (instance , & tz -> thermal_instances , tz_node )
656- if (power_actor_is_valid (params , instance ))
655+ list_for_each_entry (instance , & td -> thermal_instances , trip_node )
656+ if (power_actor_is_valid (instance ))
657657 params -> total_weight += instance -> weight ;
658658 break ;
659659 default :
0 commit comments