From patchwork Tue May 31 06:18:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 9143425 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 B77C360761 for ; Tue, 31 May 2016 06:23:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A89B928213 for ; Tue, 31 May 2016 06:23:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D9B42821C; Tue, 31 May 2016 06:23:40 +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 55559281ED for ; Tue, 31 May 2016 06:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755906AbcEaGUh (ORCPT ); Tue, 31 May 2016 02:20:37 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:32791 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755883AbcEaGUc (ORCPT ); Tue, 31 May 2016 02:20:32 -0400 Received: by mail-pa0-f68.google.com with SMTP id f8so23993209pag.0; Mon, 30 May 2016 23:20:32 -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=0aD2Voo3REksNnIDmiLEmvd/I0ipjbc7SrIIch6LBs8=; b=xqHerDJyA827wqEEsvLIiJTdeV0X3HVRcEsIy4t5rxql+acXGxWSIuix69bFvFyKQC PPZ1VaTls9LY30cF+40LGGBP67NFmbvA30/Mef0uBf43vq6Lmw8g3ihCN+ZMR3K9cVAY xDEB/CsYzt9BBd1EsOoDJySpO4VSFEZLzHtGTFW8UK4S3B+9UXCf4186asASM5VX3wD/ 32cmE0EXcgMh3mfffET5wKI1my+1byXCMBVnKbhX0wRzUeLpxTvw7Kd1Y3V8IJth4a8f 9IEJtqu1XXl6yoc0wuslXr+qmT4q8f/qAvhnynGSl0wy9j//dxTga+TLq37Lt119XJC3 HcrQ== 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=0aD2Voo3REksNnIDmiLEmvd/I0ipjbc7SrIIch6LBs8=; b=ctr+plQ7Ewzs1/Hus5m1JsiHLseP100nfc1FPhk8BCucAuUoIQd/0QhJPXUCiA9Qww zaxs1FSFkEIaIv988Kkbxqa04V7YYqP9T0YBZou8U1j/xMURUMxPP6YVz0LGf4pq+IyH dIZ06pdxE/grNgG5aLZ9uZzWXXv5OfxOvgG9T+23NHqTnjHnO0KpnvcpggeBgI7ZLcSJ QvIMsmU8GxLSaoiCmkYVTBMfpuBtcGjwMEASQdt2fXQPWvDn2hECovBd590IIFuSvnab BqFdqk8NY+J3el9iPrYTACRwyCCltcLoTYwXcoEWQMc2o1nLXpbHE4/2cwDBxxCk/ooN Iamw== X-Gm-Message-State: ALyK8tIKzJqSWIZbLBSJQyPoRrMkvrBx1oLpNGXDxe8S2ehqAqglGkuHJI9HyZIGlz8k4Q== X-Received: by 10.66.78.104 with SMTP id a8mr51984440pax.88.1464675626720; Mon, 30 May 2016 23:20:26 -0700 (PDT) Received: from localhost ([2601:b00:c501:3660:7256:81ff:febd:926d]) by smtp.gmail.com with ESMTPSA id 19sm37124587pfi.91.2016.05.30.23.20.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 May 2016 23:20:26 -0700 (PDT) From: Eduardo Valentin To: Rui Zhang Cc: Linux PM , LKML , Keerthy , Eduardo Valentin Subject: [PATCHv4 34/48] thermal: core: move __bind() to where it is used Date: Mon, 30 May 2016 23:18:41 -0700 Message-Id: <1464675535-2433-35-git-send-email-edubezval@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1464675535-2433-1-git-send-email-edubezval@gmail.com> References: <1464675535-2433-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 59fe92d..460220c 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) { @@ -804,6 +771,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;