From patchwork Wed Feb 18 16:04:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javi Merino X-Patchwork-Id: 5844861 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DB4139F30C for ; Wed, 18 Feb 2015 16:05:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17CDC20165 for ; Wed, 18 Feb 2015 16:05:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B0DF2015E for ; Wed, 18 Feb 2015 16:05:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751934AbbBRQFN (ORCPT ); Wed, 18 Feb 2015 11:05:13 -0500 Received: from foss-mx-na.arm.com ([217.140.108.86]:44004 "EHLO foss-mx-na.foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751897AbbBRQFM (ORCPT ); Wed, 18 Feb 2015 11:05:12 -0500 Received: from foss-smtp-na-1.foss.arm.com (unknown [10.80.61.8]) by foss-mx-na.foss.arm.com (Postfix) with ESMTP id EAE0E4E4; Wed, 18 Feb 2015 10:05:07 -0600 (CST) Received: from collaborate-mta1.arm.com (highbank-bc01-b06.austin.arm.com [10.112.81.134]) by foss-smtp-na-1.foss.arm.com (Postfix) with ESMTP id 6F9BC5FAC1; Wed, 18 Feb 2015 10:05:05 -0600 (CST) Received: from e104805.cambridge.arm.com (e104805.cambridge.arm.com [10.2.131.108]) by collaborate-mta1.arm.com (Postfix) with SMTP id 8582213F825; Wed, 18 Feb 2015 10:05:03 -0600 (CST) Received: by e104805.cambridge.arm.com (sSMTP sendmail emulation); Wed, 18 Feb 2015 16:05:03 +0000 From: Javi Merino To: rui.zhang@intel.com, edubezval@gmail.com Cc: linux-pm@vger.kernel.org, Javi Merino , Durgadoss R Subject: [PATCH v3 2/5] thermal: fair_share: use the weight from the thermal instance Date: Wed, 18 Feb 2015 16:04:22 +0000 Message-Id: <1424275465-16144-3-git-send-email-javi.merino@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424275465-16144-1-git-send-email-javi.merino@arm.com> References: <1424275465-16144-1-git-send-email-javi.merino@arm.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Eduardo Valentin Cc: Durgadoss R Signed-off-by: Javi Merino Reviewed-by: Durgadoss R --- 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,