Skip to content

Commit 2c06456

Browse files
lukaszluba-armrafaeljw
authored andcommitted
thermal: gov_power_allocator: Refactor check_power_actors()
In preparation for a subsequent change, rearrange check_power_actors(). No intentional functional impact. Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent a8c9594 commit 2c06456

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/thermal/gov_power_allocator.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,9 @@ static void allow_maximum_power(struct thermal_zone_device *tz, bool update)
581581
* power actor API. The warning should help to investigate the issue, which
582582
* could be e.g. lack of Energy Model for a given device.
583583
*
584-
* Return: 0 on success, -EINVAL if any cooling device does not implement
585-
* the power actor API.
584+
* If all of the cooling devices currently attached to @tz implement the power
585+
* actor API, return the number of them (which may be 0, because some cooling
586+
* devices may be attached later). Otherwise, return -EINVAL.
586587
*/
587588
static int check_power_actors(struct thermal_zone_device *tz,
588589
struct power_allocator_params *params)
@@ -597,8 +598,9 @@ static int check_power_actors(struct thermal_zone_device *tz,
597598
if (!cdev_is_power_actor(instance->cdev)) {
598599
dev_warn(&tz->device, "power_allocator: %s is not a power actor\n",
599600
instance->cdev->type);
600-
ret = -EINVAL;
601+
return -EINVAL;
601602
}
603+
ret++;
602604
}
603605

604606
return ret;
@@ -631,7 +633,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
631633
}
632634

633635
ret = check_power_actors(tz, params);
634-
if (ret) {
636+
if (ret < 0) {
635637
dev_warn(&tz->device, "power_allocator: binding failed\n");
636638
kfree(params);
637639
return ret;

0 commit comments

Comments
 (0)