From patchwork Tue Nov 8 05:09:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 9416517 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 365E660512 for ; Tue, 8 Nov 2016 05:13:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 279A428B99 for ; Tue, 8 Nov 2016 05:13:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BD8B28B9B; Tue, 8 Nov 2016 05:13:19 +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=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 9B3E128B99 for ; Tue, 8 Nov 2016 05:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932415AbcKHFKy (ORCPT ); Tue, 8 Nov 2016 00:10:54 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:32967 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932219AbcKHFKv (ORCPT ); Tue, 8 Nov 2016 00:10:51 -0500 Received: by mail-pf0-f194.google.com with SMTP id 144so9693140pfv.0; Mon, 07 Nov 2016 21:10:51 -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=K5hoF4UbRq1RZSMxoEJPeFkD0q79O7Hxit0rVsRWjiE=; b=bSgiLEbP8pCWAIJ9W+uqXp9o4hfCF8x9aXF0QCGhVUSJY0CKLVp1iULv6M4ahhGmV9 onToHTU9mDi+TiSHIkb7N+DiQO9OzgT/HdEmoHFKIHKKDVwgs+Hd7Or3vtzotwu0Hamc 4M+f4yPtanE+OTqu9EKZPGGPerL6poIUeiy/5vZ/X0oNp2BFxNKF9qSSlaWS8J4Ea7AB tF8E+6k5VVGYwth93pCUFmOgfK1XratAGbFljmZj8fvuOlP2coiyQU+uFv1fAY6i9DEx xpRV93BDWOZXELkf4eFOnRU/IVEijggEbphDjZgWszxl2wYmrhNvkQPReBL5ihzIawAC JGig== 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=K5hoF4UbRq1RZSMxoEJPeFkD0q79O7Hxit0rVsRWjiE=; b=kmKXsbK6xY32Oygrzq6rxlFeo1JxsPI1utfh5nxceP/GWMuKnvZN63hIIKTOa4PUjk 389DdWokLKCaSFlKJXpMJvbXFSqZs5CqsBKO4dhRRrI9aFMnB8Q4yMLryDvLHS5VzU6m sYYxGRcoCQo6yNQanwTb0UMyB8UzcCMUtpAcLCZQYMfoySBfrmQ8as0y2Kusd060GVS0 CJcfEvb7nXEvC/J6fKy8h5qUZWpmEKLPI8X1Bkp8IYXlruq9ITAA3tRT9jbopXbJYr1m m0xQoDOjUq1+K7RAyStr73l+3+kmbkUDGAB/GFq9VnMS0yUWQuSLYb/ZSU6xyT/UI3G0 7vFA== X-Gm-Message-State: ABUngvf/DkAyNX9ynoQOV2v2PuPnwDD+EI4Tdxo21L2BAShCM60qtjAsCmUDGF9o7pA73g== X-Received: by 10.99.45.7 with SMTP id t7mr4134694pgt.86.1478581850978; Mon, 07 Nov 2016 21:10:50 -0800 (PST) Received: from localhost ([2601:647:4401:a2f0:7256:81ff:febd:926d]) by smtp.gmail.com with ESMTPSA id g78sm44392395pfe.19.2016.11.07.21.10.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Nov 2016 21:10:50 -0800 (PST) From: Eduardo Valentin To: Rui Zhang Cc: LKML , Linux PM , Eduardo Valentin Subject: [PATCHv2 32/49] thermal: core: move bind_tz() to where it is used Date: Mon, 7 Nov 2016 21:09:10 -0800 Message-Id: <1478581767-7009-33-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 | 80 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index e397d88..bff2905 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -319,46 +319,6 @@ static void __bind(struct thermal_zone_device *tz, int mask, } } -static void bind_tz(struct thermal_zone_device *tz) -{ - int i, ret; - struct thermal_cooling_device *pos = NULL; - const struct thermal_zone_params *tzp = tz->tzp; - - if (!tzp && !tz->ops->bind) - return; - - mutex_lock(&thermal_list_lock); - - /* If there is ops->bind, try to use ops->bind */ - if (tz->ops->bind) { - list_for_each_entry(pos, &thermal_cdev_list, node) { - ret = tz->ops->bind(tz, pos); - if (ret) - print_bind_err_msg(tz, pos, ret); - } - goto exit; - } - - if (!tzp || !tzp->tbp) - goto exit; - - list_for_each_entry(pos, &thermal_cdev_list, node) { - for (i = 0; i < tzp->num_tbps; i++) { - if (tzp->tbp[i].cdev || !tzp->tbp[i].match) - continue; - if (tzp->tbp[i].match(tz, pos)) - continue; - tzp->tbp[i].cdev = pos; - __bind(tz, tzp->tbp[i].trip_mask, pos, - tzp->tbp[i].binding_limits, - tzp->tbp[i].weight); - } - } -exit: - mutex_unlock(&thermal_list_lock); -} - static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, int delay) { @@ -1094,6 +1054,46 @@ void thermal_notify_framework(struct thermal_zone_device *tz, int trip) } EXPORT_SYMBOL_GPL(thermal_notify_framework); +static void bind_tz(struct thermal_zone_device *tz) +{ + int i, ret; + struct thermal_cooling_device *pos = NULL; + const struct thermal_zone_params *tzp = tz->tzp; + + if (!tzp && !tz->ops->bind) + return; + + mutex_lock(&thermal_list_lock); + + /* If there is ops->bind, try to use ops->bind */ + if (tz->ops->bind) { + list_for_each_entry(pos, &thermal_cdev_list, node) { + ret = tz->ops->bind(tz, pos); + if (ret) + print_bind_err_msg(tz, pos, ret); + } + goto exit; + } + + if (!tzp || !tzp->tbp) + goto exit; + + list_for_each_entry(pos, &thermal_cdev_list, node) { + for (i = 0; i < tzp->num_tbps; i++) { + if (tzp->tbp[i].cdev || !tzp->tbp[i].match) + continue; + if (tzp->tbp[i].match(tz, pos)) + continue; + tzp->tbp[i].cdev = pos; + __bind(tz, tzp->tbp[i].trip_mask, pos, + tzp->tbp[i].binding_limits, + tzp->tbp[i].weight); + } + } +exit: + mutex_unlock(&thermal_list_lock); +} + /** * thermal_zone_device_register() - register a new thermal zone device * @type: the thermal zone device type