From patchwork Tue Nov 8 05:09:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 9416925 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8EC3960585 for ; Tue, 8 Nov 2016 09:05:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8025628CC9 for ; Tue, 8 Nov 2016 09:05:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7465B28CE0; Tue, 8 Nov 2016 09:05:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECAED28CC9 for ; Tue, 8 Nov 2016 09:04:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932546AbcKHJE5 (ORCPT ); Tue, 8 Nov 2016 04:04:57 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35787 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932349AbcKHJEx (ORCPT ); Tue, 8 Nov 2016 04:04:53 -0500 Received: by mail-pf0-f193.google.com with SMTP id i88so18648481pfk.2; Tue, 08 Nov 2016 01:04:53 -0800 (PST) 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=3TVA+tk9kqnlaKRGQRHbP3+W63S/yPKOCon/tk9ze3Y=; b=mjGFWHOnMqHZENrMh61qEkAEKyfBcrEea1YB5HG15/KgIL1B2J7QwOXIRMStbidrDO xC1dh5xpVUJxMafnrzM1Ju00xAFaenGT2jniKLJTHl39J6ptrymUfjC2XpMPjPPMOHH4 22gxjEmEWWKbdMK9+NDsyNEXMfeayncviipm83BudVWUPbJrWyMtavI0VdXAwK/3P6cI tb+dOGDe3nfWuVD3fTwrKvQaxmCWz9rk1dB2aNquEYh1j3UfrdqX9wYSCLxXolQXx+RO YHsynyCWfxTONi+wIwHuY0d/2s35rtzc+FK92drrpI2K994GJZOZbu/qsfSF32L6w9Ub E2mw== 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=3TVA+tk9kqnlaKRGQRHbP3+W63S/yPKOCon/tk9ze3Y=; b=VVqsi5p23aahaRHwkWUmlxowr8f0mV04cuoeCaVV8Sr/8/AmDP4nixEhrWIlE0Agxj T/7qhDr27AQOgIlxLdXURscPWIKbKdh1IZY2loj4tv3c9nVdPL1t3X9bVJWNdYOvNBgR 967uBCA7eUpVu72DEIwx+QKqkJGoeFPo/vP/1NuzqMQX8ULL4OT8M0a38qN7lJgtIS06 MtsCZx86hBOGt6l1xm6jPoeHdvlN2YJpio2ki6UsU0r6j/yBARG2OkCoq2Iq3knIqcZh TA7uV46qEwiC3+zWrFtpWTHSxopDO63/jCVmrUsfMYVn3+5RceWLHmFwjlXNbXcA7NNy SOsA== X-Gm-Message-State: ABUngvdFTEQFuUmJ/HzwR011+f6mPjbG8WUnSC5rNL4bauV9SCDXpLOJnKtdxa7xUZG15g== X-Received: by 10.98.141.153 with SMTP id p25mr19909327pfk.148.1478581853722; Mon, 07 Nov 2016 21:10:53 -0800 (PST) Received: from localhost ([2601:647:4401:a2f0:7256:81ff:febd:926d]) by smtp.gmail.com with ESMTPSA id 186sm39102200pfv.61.2016.11.07.21.10.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Nov 2016 21:10:53 -0800 (PST) From: Eduardo Valentin To: Rui Zhang Cc: LKML , Linux PM , Eduardo Valentin Subject: [PATCHv2 34/49] thermal: core: move __bind() to where it is used Date: Mon, 7 Nov 2016 21:09:12 -0800 Message-Id: <1478581767-7009-35-git-send-email-edubezval@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1478581767-7009-1-git-send-email-edubezval@gmail.com> References: <1478581767-7009-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-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 ebec7ce..258962b 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) { @@ -811,6 +778,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;