From patchwork Tue Nov 8 05:09:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 9416607 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 CF1E560459 for ; Tue, 8 Nov 2016 05:28:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFEF828B9D for ; Tue, 8 Nov 2016 05:28:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4B9828BA3; Tue, 8 Nov 2016 05:28:01 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable 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 C204428B9E for ; Tue, 8 Nov 2016 05:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753589AbcKHF1m (ORCPT ); Tue, 8 Nov 2016 00:27:42 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34831 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751062AbcKHF12 (ORCPT ); Tue, 8 Nov 2016 00:27:28 -0500 Received: by mail-pf0-f195.google.com with SMTP id i88so18094789pfk.2; Mon, 07 Nov 2016 21:27:28 -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=VOHWrRHGL25v0KW1TRpcw0y1MvJYdn3i2HrqnHQeLno=; b=Ym7LHt2TjjKuNNCyeQ4Pm6xlii86QiCvPIwu0beh8LLfRZwHaYEOP80K7F7/PpBaD0 xQWoGcajAfhiJv8Ig9SdQ1GHiFb1KGbFVILWbiVL3XAqeQu4jvnaGFoDj2b//q4CdtSS yi+lMyse8CVe4IV0WN7wJhYRsXIJmgXY+OlMiJd2KNzVlgdKFEysJY40siSOrJik71VL roASudw86la7psG8dUnT3VXcrrfd0b8W8QDSddaftUDrSER0HuF2jEaT3wG+LuYIMe8s vsRuUv5GIGXkTqmRe1IjgV+YOLus7Ncww0Idr0MmcZgaN5HDMsghrH66/tV9O7zcr3gu UezA== 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=VOHWrRHGL25v0KW1TRpcw0y1MvJYdn3i2HrqnHQeLno=; b=lfyGxHN96XIDVTK3HPMkvAoVfTYSl9CumZRs+6xUrT4XlRTldCrMbPrp2JOynaNW0X zo032phdwFzpO6TiIFaxhPKoHmQIjgBG4G4vnlKGqeWAyb4+E5GygTLeTzqH3uQZaG6j uWvrG142bMADx6M/OrF5ntSMAkgAu72VnVJsCNKXsSp9OlJ3QEh35stTT40Lskq2a2eT zd9Qq3UvPhewApx8GHIgoEwHDu2FuZZCQtgA+fkMgC2uxTRJCCgYI7i3dA21wEgLUqw8 svmy7YhbndOzsmfRP4JNC7JGjHnAuL2CL13ClJO45VxKGwmkuuXL9+D2aOcwj2s3e7NE c7MA== X-Gm-Message-State: ABUngvfPHFJ0+3ETZmm3bS1J0dZSR63Ag+Rq08Gbplo0X5SztAUkitIF25yqeo6RmtieXA== X-Received: by 10.99.146.76 with SMTP id s12mr4119841pgn.8.1478581849225; Mon, 07 Nov 2016 21:10:49 -0800 (PST) Received: from localhost ([2601:647:4401:a2f0:7256:81ff:febd:926d]) by smtp.gmail.com with ESMTPSA id yc7sm44506539pab.24.2016.11.07.21.10.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Nov 2016 21:10:48 -0800 (PST) From: Eduardo Valentin To: Rui Zhang Cc: LKML , Linux PM , Eduardo Valentin Subject: [PATCHv2 31/49] thermal: core: move bind_cdev() to where it is used Date: Mon, 7 Nov 2016 21:09:09 -0800 Message-Id: <1478581767-7009-32-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 | 76 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index c121933..e397d88 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -319,44 +319,6 @@ static void __bind(struct thermal_zone_device *tz, int mask, } } -static void bind_cdev(struct thermal_cooling_device *cdev) -{ - int i, ret; - const struct thermal_zone_params *tzp; - struct thermal_zone_device *pos = NULL; - - mutex_lock(&thermal_list_lock); - - list_for_each_entry(pos, &thermal_tz_list, node) { - if (!pos->tzp && !pos->ops->bind) - continue; - - if (pos->ops->bind) { - ret = pos->ops->bind(pos, cdev); - if (ret) - print_bind_err_msg(pos, cdev, ret); - continue; - } - - tzp = pos->tzp; - if (!tzp || !tzp->tbp) - continue; - - for (i = 0; i < tzp->num_tbps; i++) { - if (tzp->tbp[i].cdev || !tzp->tbp[i].match) - continue; - if (tzp->tbp[i].match(pos, cdev)) - continue; - tzp->tbp[i].cdev = cdev; - __bind(pos, tzp->tbp[i].trip_mask, cdev, - tzp->tbp[i].binding_limits, - tzp->tbp[i].weight); - } - } - - mutex_unlock(&thermal_list_lock); -} - static void bind_tz(struct thermal_zone_device *tz) { int i, ret; @@ -889,6 +851,44 @@ static struct class thermal_class = { .dev_release = thermal_release, }; +static void bind_cdev(struct thermal_cooling_device *cdev) +{ + int i, ret; + const struct thermal_zone_params *tzp; + struct thermal_zone_device *pos = NULL; + + mutex_lock(&thermal_list_lock); + + list_for_each_entry(pos, &thermal_tz_list, node) { + if (!pos->tzp && !pos->ops->bind) + continue; + + if (pos->ops->bind) { + ret = pos->ops->bind(pos, cdev); + if (ret) + print_bind_err_msg(pos, cdev, ret); + continue; + } + + tzp = pos->tzp; + if (!tzp || !tzp->tbp) + continue; + + for (i = 0; i < tzp->num_tbps; i++) { + if (tzp->tbp[i].cdev || !tzp->tbp[i].match) + continue; + if (tzp->tbp[i].match(pos, cdev)) + continue; + tzp->tbp[i].cdev = cdev; + __bind(pos, tzp->tbp[i].trip_mask, cdev, + tzp->tbp[i].binding_limits, + tzp->tbp[i].weight); + } + } + + mutex_unlock(&thermal_list_lock); +} + /** * __thermal_cooling_device_register() - register a new thermal cooling device * @np: a pointer to a device tree node.