diff mbox

[v3,2/5] thermal: fair_share: use the weight from the thermal instance

Message ID 1424275465-16144-3-git-send-email-javi.merino@arm.com (mailing list archive)
State Accepted
Delegated to: Eduardo Valentin
Headers show

Commit Message

Javi Merino Feb. 18, 2015, 4:04 p.m. UTC
The fair share governor is not usable with thermal zones that use the
bind op and don't populate thermal_zone_parameters, the majority of
them.  Now that the weight is in the thermal instance, we can use that
in the fair share governor to allow every thermal zone to trivially use
this governor.  Furthermore, this simplifies the code.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
---
 drivers/thermal/fair_share.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

Comments

durgadoss.r@intel.com Feb. 19, 2015, 5:40 a.m. UTC | #1
>-----Original Message-----
>From: Javi Merino [mailto:javi.merino@arm.com]
>Sent: Wednesday, February 18, 2015 9:34 PM
>To: Zhang, Rui; edubezval@gmail.com
>Cc: linux-pm@vger.kernel.org; Javi Merino; R, Durgadoss
>Subject: [PATCH v3 2/5] thermal: fair_share: use the weight from the thermal instance
>
>The fair share governor is not usable with thermal zones that use the
>bind op and don't populate thermal_zone_parameters, the majority of
>them.  Now that the weight is in the thermal instance, we can use that
>in the fair share governor to allow every thermal zone to trivially use
>this governor.  Furthermore, this simplifies the code.

Reviewed-by: Durgadoss R <durgadoss.r@intel.com>

>
>Cc: Zhang Rui <rui.zhang@intel.com>
>Cc: Eduardo Valentin <edubezval@gmail.com>
>Cc: Durgadoss R <durgadoss.r@intel.com>
>Signed-off-by: Javi Merino <javi.merino@arm.com>
>---
> drivers/thermal/fair_share.c | 17 +++--------------
> 1 file changed, 3 insertions(+), 14 deletions(-)
>
>diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/fair_share.c
>index c3b25187b467..9e392d34ac9f 100644
>--- a/drivers/thermal/fair_share.c
>+++ b/drivers/thermal/fair_share.c
>@@ -88,24 +88,13 @@ static long get_target_state(struct thermal_zone_device *tz,
>  */
> static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
> {
>-	const struct thermal_zone_params *tzp;
>-	struct thermal_cooling_device *cdev;
> 	struct thermal_instance *instance;
>-	int i;
> 	int cur_trip_level = get_trip_level(tz);
>
>-	if (!tz->tzp || !tz->tzp->tbp)
>-		return -EINVAL;
>+	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
>+		struct thermal_cooling_device *cdev = instance->cdev;
>
>-	tzp = tz->tzp;
>-
>-	for (i = 0; i < tzp->num_tbps; i++) {
>-		if (!tzp->tbp[i].cdev)
>-			continue;
>-
>-		cdev = tzp->tbp[i].cdev;
>-		instance = get_thermal_instance(tz, cdev, trip);
>-		if (!instance)
>+		if (instance->trip != trip)
> 			continue;
>
> 		instance->target = get_target_state(tz, cdev,
>--
>1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/fair_share.c
index c3b25187b467..9e392d34ac9f 100644
--- a/drivers/thermal/fair_share.c
+++ b/drivers/thermal/fair_share.c
@@ -88,24 +88,13 @@  static long get_target_state(struct thermal_zone_device *tz,
  */
 static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
 {
-	const struct thermal_zone_params *tzp;
-	struct thermal_cooling_device *cdev;
 	struct thermal_instance *instance;
-	int i;
 	int cur_trip_level = get_trip_level(tz);
 
-	if (!tz->tzp || !tz->tzp->tbp)
-		return -EINVAL;
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
+		struct thermal_cooling_device *cdev = instance->cdev;
 
-	tzp = tz->tzp;
-
-	for (i = 0; i < tzp->num_tbps; i++) {
-		if (!tzp->tbp[i].cdev)
-			continue;
-
-		cdev = tzp->tbp[i].cdev;
-		instance = get_thermal_instance(tz, cdev, trip);
-		if (!instance)
+		if (instance->trip != trip)
 			continue;
 
 		instance->target = get_target_state(tz, cdev,