From patchwork Wed May 4 06:02:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 9010311 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 81E3DBF29F for ; Wed, 4 May 2016 06:05:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD3D6202EC for ; Wed, 4 May 2016 06:05:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF13D2027D for ; Wed, 4 May 2016 06:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757430AbcEDGFA (ORCPT ); Wed, 4 May 2016 02:05:00 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:36203 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757310AbcEDGDd (ORCPT ); Wed, 4 May 2016 02:03:33 -0400 Received: by mail-pa0-f42.google.com with SMTP id bt5so19918023pac.3; Tue, 03 May 2016 23:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XZsZ9eK6huxvIaJufmZwA0LIHKEVig+34VKrreacNiA=; b=fxE0wzudbIJJRFx4SWs2uMoLIccb2EAo6fhyeBMRjpgUPJ1pizmAWzAcUpB1i1vgc1 FoNWCNfmpAVv0AXcU0wA1Rso1eUwzNIXuMgwv434H7c2bZIirZgdx3NFQsxN0Xrbdn/m zc/JZwK9O5UnuLj1U0+6/1ldf+hSznMpRPheiF9r9JlAOwasWY+1cwx9Swj6dXJF2vPW 5q/5J8ONZkIkMoqOOpmHWc67Nk8uzAgKlK6UtOmdtmJNpwl39SttlTk4O06uka9HuOdg /NQ3bJJeebYdwkxo/bvDNCKE711xeiQembEHM4ti/oUEHxeznnL2TFu92wE7VtVjeC4Q QV2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XZsZ9eK6huxvIaJufmZwA0LIHKEVig+34VKrreacNiA=; b=PvB8AKA2ESOfVfSct1G+808eSvbKDrlDNT11s8aQ2kERxHfG2R/OgtrxcyofHu3k5c DYMA60jsZ5xHj9rhhQpFgJu86cI8VyKU+8hsu0ozlmkVIt7bKcNZmmnEF+KwRil44qjh pwi6QcJhcL692M/tQOLDrd2VgcOBzbgbZ06q71nbnpSr8fPIrTd+xP21guDyKpQDUGbW Vb+Eml+PLve/zPDakxlvReeKVvZct3dmz1CkMJGPtQkhkCuennxjtXGEJGIq4JueEGOy KAcXO/5pysclSVH9+OBLUCXN0WJwiXOsrSA3J9g98We3jqH8n3bBhg7AquOgFDNIIz+Q xPNQ== X-Gm-Message-State: AOPr4FXg9fFjObs3WkMjO0hmfp0s9Qj3lETiWNiaUyIBTI/C3qfBtRiFwVwNRycH3/SOxg== X-Received: by 10.66.166.78 with SMTP id ze14mr9506271pab.149.1462341812555; Tue, 03 May 2016 23:03:32 -0700 (PDT) Received: from localhost ([2601:647:4203:c8e0:7256:81ff:febd:926d]) by smtp.gmail.com with ESMTPSA id i1sm2659027pfj.17.2016.05.03.23.03.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 May 2016 23:03:31 -0700 (PDT) From: Eduardo Valentin To: Rui Zhang Cc: Linux PM , LKML , Eduardo Valentin Subject: [PATCH 26/31] thermal: core: move __bind() to where it is used Date: Tue, 3 May 2016 23:02:40 -0700 Message-Id: <1462341765-13268-27-git-send-email-edubezval@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1462341765-13268-1-git-send-email-edubezval@gmail.com> References: <1462341765-13268-1-git-send-email-edubezval@gmail.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=-8.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 Moving the helper to closer where it is used. Cc: Zhang Rui Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin --- drivers/thermal/thermal_core.c | 66 +++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 7182bec..d836a90 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -286,39 +286,6 @@ static void thermal_unregister_governors(void) thermal_gov_power_allocator_unregister(); } -static void print_bind_err_msg(struct thermal_zone_device *tz, - struct thermal_cooling_device *cdev, int ret) -{ - dev_err(&tz->device, "binding zone %s with cdev %s failed:%d\n", - tz->type, cdev->type, ret); -} - -static void __bind(struct thermal_zone_device *tz, int mask, - struct thermal_cooling_device *cdev, - unsigned long *limits, - unsigned int weight) -{ - int i, ret; - - for (i = 0; i < tz->trips; i++) { - if (mask & (1 << i)) { - unsigned long upper, lower; - - upper = THERMAL_NO_LIMIT; - lower = THERMAL_NO_LIMIT; - if (limits) { - lower = limits[i * 2]; - upper = limits[i * 2 + 1]; - } - ret = thermal_zone_bind_cooling_device(tz, i, cdev, - upper, lower, - weight); - if (ret) - print_bind_err_msg(tz, cdev, ret); - } - } -} - static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, int delay) { @@ -803,6 +770,39 @@ static struct class thermal_class = { .dev_release = thermal_release, }; +static void print_bind_err_msg(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev, int ret) +{ + dev_err(&tz->device, "binding zone %s with cdev %s failed:%d\n", + tz->type, cdev->type, ret); +} + +static void __bind(struct thermal_zone_device *tz, int mask, + struct thermal_cooling_device *cdev, + unsigned long *limits, + unsigned int weight) +{ + int i, ret; + + for (i = 0; i < tz->trips; i++) { + if (mask & (1 << i)) { + unsigned long upper, lower; + + upper = THERMAL_NO_LIMIT; + lower = THERMAL_NO_LIMIT; + if (limits) { + lower = limits[i * 2]; + upper = limits[i * 2 + 1]; + } + ret = thermal_zone_bind_cooling_device(tz, i, cdev, + upper, lower, + weight); + if (ret) + print_bind_err_msg(tz, cdev, ret); + } + } +} + static void bind_cdev(struct thermal_cooling_device *cdev) { int i, ret;