From patchwork Wed May 4 06:02:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 9010341 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 45C849F1C1 for ; Wed, 4 May 2016 06:05:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 568F8202EC for ; Wed, 4 May 2016 06:05:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C0112027D for ; Wed, 4 May 2016 06:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757139AbcEDGFg (ORCPT ); Wed, 4 May 2016 02:05:36 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:35044 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757295AbcEDGDa (ORCPT ); Wed, 4 May 2016 02:03:30 -0400 Received: by mail-pf0-f171.google.com with SMTP id 77so20991871pfv.2; Tue, 03 May 2016 23:03:30 -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=zxShtrGFMVOV5lYMBwY+2K3sqWLlZW4+oh4737eSR9k=; b=OXKq2MO0PXbEdXEZK7D/UE8F/nUuB7VzmTmlBGbvcljJlPzAT6bWS3Bnf2u5K8OHgt ch/Z3bbqsi2IxxPfAjskP5xxS80No8ZO+W3wxkxAwd8uvhYs9soS0OE/gWUSSomsXUDx AHYl1ayFP6FIxcF4V9A0fOPPCxVw+WrTq1W1n5kbFKUlDdIZQdx5H0dHXTjHvSFOQpLK sEayiKd9hr6iTQTSybnfxhUi5cvuUJatFG4P+OHOczeoUZSdQkN+FsU4bbig/X7eHJwF O3rbYIbX5yRgoMlQA7raqyCXSN/zS9UqokNHp8GsX9r0PZRtUMRvBA3Gz4jdLujqfOZ4 URXA== 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=zxShtrGFMVOV5lYMBwY+2K3sqWLlZW4+oh4737eSR9k=; b=koDNeAa2rILha0/uKtf+4Av+8MaKv/LEfObSz92KCkaYanGXYS9DVM8tLD5rjkHsOP rvk+40oUeMm5Knc/9OSBFPb7tvM34d593q2cHy1X0E4QBnlyc/8IJqBowCWGBgDwfFWl J09yz4ju9NKJ1cxi4tLNF+/HrDC2TRGOZKCAXXKcmIA9+x/IcBj4N4FPWx7cBJGv0KVq 1YmH5DtNjQ83bPHg2WiGgPGXoLbVOvchHfefAw/b1l0kweaX/f0yMbhUnz4v1IUi42mK /77iBx+G/1qoTBrZT4Y+E8fblIRgkgNw1B+IAA0eNRLGDlcrlS76QT/csdAYyI7XyoWd 30BA== X-Gm-Message-State: AOPr4FVgmBFt2A06DGURqvnHT8tQMcT43c2PZqwb0GDfx5s9ysnrOZUfHY4GZznxJZvrZw== X-Received: by 10.98.79.213 with SMTP id f82mr9486044pfj.65.1462341809658; Tue, 03 May 2016 23:03:29 -0700 (PDT) Received: from localhost ([2601:647:4203:c8e0:7256:81ff:febd:926d]) by smtp.gmail.com with ESMTPSA id o63sm2653277pfj.30.2016.05.03.23.03.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 May 2016 23:03:28 -0700 (PDT) From: Eduardo Valentin To: Rui Zhang Cc: Linux PM , LKML , Eduardo Valentin Subject: [PATCH 24/31] thermal: core: move bind_cdev() to where it is used Date: Tue, 3 May 2016 23:02:38 -0700 Message-Id: <1462341765-13268-25-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 | 76 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index e1515f3..cbe9829 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; @@ -881,6 +843,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.