From patchwork Wed May 4 06:02:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 9010271 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 E1895BF29F for ; Wed, 4 May 2016 06:04:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 08AC9202EC for ; Wed, 4 May 2016 06:04:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CAEFA2027D for ; Wed, 4 May 2016 06:04:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757333AbcEDGDe (ORCPT ); Wed, 4 May 2016 02:03:34 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33668 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757325AbcEDGDc (ORCPT ); Wed, 4 May 2016 02:03:32 -0400 Received: by mail-pa0-f45.google.com with SMTP id xk12so20288939pac.0; Tue, 03 May 2016 23:03:31 -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=x4D/O5wuP/mVVmk2JobryNKWsgo42xDlYI05ooHJv/Y=; b=lEwylPn1Oz5fJajxgi8LuuCM8Wh4XfVsxyAhcIWL2Y+0xNqwKbZi47NE4nN+frtghd zJXNgmmdwwj2EEDORbD9XZnwsTyWT+nhYuwzPOLgROD3vqdyNps/6E6C16SFyNpl0byE qG12VdNuKgc1kukGoDDuHoAtDoniBYlyJN4CUwtLlPlESh1aGa85UxiUbwpMlDxIpLh+ lkDHlFjfjNBXGUgPd7c5GdKfOZ6Onn696vLIWaEmtqjPMFk6uQJL9SjfQ1fvZD1Y+exa 4hxuE1KOSgVvYuMdhQEi2q8S3E1woXsU1vuGhEpg9LhwWhTcOoFf/oU28jkT9FvTVzWa /Uhw== 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=x4D/O5wuP/mVVmk2JobryNKWsgo42xDlYI05ooHJv/Y=; b=S85UuMOBME+rgqn6J0/xawS2/1OuGmSfJU1POSMzZLVfW2xqs6cXKlp/wxCleuglqU ymEuxcfReAV9oDmeCYXPiA8gn5iCk+2/1udP/lI/JzeIY3/sidN5tzztdcKjfHMpYt8Y ebi7tWGPCJNIGAgkQZzJR7GXfwrSVxLI1h9nwl3SjN42qbtc8seGHxTnm5iXj2IfMwbR ergo0LXJZY5FYU4rT1jTaGiuohI2T7/TqzXyEZMd5vIkH4b9qSWL1tVsetjLgMeA/55u eS1s/RXJE0Xal17DyF56Wae+XFwuCP5H/hl0B8VinvmaLNdpBH7Oq5VKuEsAz5zkWBoJ okzA== X-Gm-Message-State: AOPr4FV9+V2oP5oBBCs9EhiFi8rfutSFKVk/NVgIkSEnGvLyl/FD3M4Xe36ONbPKMTerDA== X-Received: by 10.66.78.104 with SMTP id a8mr9618949pax.88.1462341811058; Tue, 03 May 2016 23:03:31 -0700 (PDT) Received: from localhost ([2601:647:4203:c8e0:7256:81ff:febd:926d]) by smtp.gmail.com with ESMTPSA id 5sm2616158pfi.91.2016.05.03.23.03.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 May 2016 23:03:30 -0700 (PDT) From: Eduardo Valentin To: Rui Zhang Cc: Linux PM , LKML , Eduardo Valentin Subject: [PATCH 25/31] thermal: core: move bind_tz() to where it is used Date: Tue, 3 May 2016 23:02:39 -0700 Message-Id: <1462341765-13268-26-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 | 80 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index cbe9829..7182bec 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) { @@ -1085,6 +1045,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