From patchwork Wed Oct 25 07:03:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 10025963 X-Patchwork-Delegate: eduardo.valentin@ti.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 B58FF60381 for ; Wed, 25 Oct 2017 07:03:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A851828AF7 for ; Wed, 25 Oct 2017 07:03:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D3B628AF9; Wed, 25 Oct 2017 07:03:57 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 4E77628AF7 for ; Wed, 25 Oct 2017 07:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751995AbdJYHDo (ORCPT ); Wed, 25 Oct 2017 03:03:44 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:54412 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970AbdJYHDn (ORCPT ); Wed, 25 Oct 2017 03:03:43 -0400 Received: by mail-pf0-f193.google.com with SMTP id n89so21539721pfk.11; Wed, 25 Oct 2017 00:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=L2fDTdL+5rXlkfDzXehb+qHPBWz6g5uZuVHKEQ69kb8=; b=iIgeitCHh/4Uq03Se7j69HhbRIN1tjKYlMAph0akOvNXu8ZDkI/4fbB9JgVYC+fJd/ McHe8x2hibucDHj2MUWRiBKVtdJbqUtQPOYMJoXxcU3qJjyHfUYVLJRyfbF0qjP3f/eK eMASczLEZtyXJhazPn18IokRXsx1NkoYMFSi3BlS3KZBjDtTPS7ncVy61uLdBHJCOp4t aiP4ufZGt7WZB0bKHtAbavZ04ViQ7f5MPbggtjlyAIh/+DDZv27SIiKQ8LHQit2/pD9y CyookSrqnua613MxNq6KVr904qAPy/W10PRzQkMf5QaBxRk9k+hxOeE/3+1Yd6P7ke/e jJ0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=L2fDTdL+5rXlkfDzXehb+qHPBWz6g5uZuVHKEQ69kb8=; b=MT9nppEPoVskGdmbDVRovmgSaeIlIocQJxJx9q/NwTD5P8cYpddqJ6C+77iM5wneiY DB/5z7EiLg8wmS4C5FKqy7ZEGJyCiu2VcP+x4clHvD+R2gchSi6LQtpWhFBp3gnkvY5+ rjRHKfXWukN6IzuLkEy6JBjDcpnT5vLIi/x/jsHqgKIUZ3sNOLNrMwxyeqfPVV2+bDS7 HX/UV/BDIm/c1SdpQpq8U9SpczLMlW0EFC2Etu0BbV0hSn56N133zhwpu2VyipUUmSlA d0YY6qjShm5QldHDXQkaLcQoEK/S09E/PdKmXsdErz+Y+zRk90vihemF7p3T4MQFj0T1 uM4g== X-Gm-Message-State: AMCzsaWnhcor+evBjdeHRLoakZOmOB6TwsQPxMiGbZDZHF/RgQHkO4OQ XqEnu1GMO1EwhzMQMUllrYk= X-Google-Smtp-Source: ABhQp+QkYpIGm1kvJFJBy54O4krhrSUpr3z7DggzW9zQNPl6mNkeh+otMsvLdgegi818RdgNca93Rw== X-Received: by 10.98.103.72 with SMTP id b69mr1241088pfc.251.1508915022374; Wed, 25 Oct 2017 00:03:42 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id f10sm3192184pgr.8.2017.10.25.00.03.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 00:03:41 -0700 (PDT) From: Nicolin Chen To: rui.zhang@intel.com, edubezval@gmail.com Cc: thierry.reding@gmail.com, jonathanh@nvidia.com, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, srikars@nvidia.com Subject: [PATCH] thermal: tegra: remove forward declarations Date: Wed, 25 Oct 2017 00:03:37 -0700 Message-Id: <1508915017-23234-1-git-send-email-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.1.4 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 This patch just simply moves tegra_thermctl_set_trip_temp() behind those function implementations so that it can remove those forward declarations. Signed-off-by: Nicolin Chen --- drivers/thermal/tegra/soctherm.c | 103 ++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 56 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index 075db1d..455b58c 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -341,62 +341,6 @@ static int tegra_thermctl_get_temp(void *data, int *out_temp) return 0; } -static int -thermtrip_program(struct device *dev, const struct tegra_tsensor_group *sg, - int trip_temp); -static int -throttrip_program(struct device *dev, const struct tegra_tsensor_group *sg, - struct soctherm_throt_cfg *stc, int trip_temp); -static struct soctherm_throt_cfg * -find_throttle_cfg_by_name(struct tegra_soctherm *ts, const char *name); - -static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp) -{ - struct tegra_thermctl_zone *zone = data; - struct thermal_zone_device *tz = zone->tz; - struct tegra_soctherm *ts = zone->ts; - const struct tegra_tsensor_group *sg = zone->sg; - struct device *dev = zone->dev; - enum thermal_trip_type type; - int ret; - - if (!tz) - return -EINVAL; - - ret = tz->ops->get_trip_type(tz, trip, &type); - if (ret) - return ret; - - if (type == THERMAL_TRIP_CRITICAL) { - return thermtrip_program(dev, sg, temp); - } else if (type == THERMAL_TRIP_HOT) { - int i; - - for (i = 0; i < THROTTLE_SIZE; i++) { - struct thermal_cooling_device *cdev; - struct soctherm_throt_cfg *stc; - - if (!ts->throt_cfgs[i].init) - continue; - - cdev = ts->throt_cfgs[i].cdev; - if (get_thermal_instance(tz, cdev, trip)) - stc = find_throttle_cfg_by_name(ts, cdev->type); - else - continue; - - return throttrip_program(dev, sg, stc, temp); - } - } - - return 0; -} - -static const struct thermal_zone_of_device_ops tegra_of_thermal_ops = { - .get_temp = tegra_thermctl_get_temp, - .set_trip_temp = tegra_thermctl_set_trip_temp, -}; - /** * enforce_temp_range() - check and enforce temperature range [min, max] * @trip_temp: the trip temperature to check @@ -527,6 +471,53 @@ find_throttle_cfg_by_name(struct tegra_soctherm *ts, const char *name) return NULL; } +static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp) +{ + struct tegra_thermctl_zone *zone = data; + struct thermal_zone_device *tz = zone->tz; + struct tegra_soctherm *ts = zone->ts; + const struct tegra_tsensor_group *sg = zone->sg; + struct device *dev = zone->dev; + enum thermal_trip_type type; + int ret; + + if (!tz) + return -EINVAL; + + ret = tz->ops->get_trip_type(tz, trip, &type); + if (ret) + return ret; + + if (type == THERMAL_TRIP_CRITICAL) { + return thermtrip_program(dev, sg, temp); + } else if (type == THERMAL_TRIP_HOT) { + int i; + + for (i = 0; i < THROTTLE_SIZE; i++) { + struct thermal_cooling_device *cdev; + struct soctherm_throt_cfg *stc; + + if (!ts->throt_cfgs[i].init) + continue; + + cdev = ts->throt_cfgs[i].cdev; + if (get_thermal_instance(tz, cdev, trip)) + stc = find_throttle_cfg_by_name(ts, cdev->type); + else + continue; + + return throttrip_program(dev, sg, stc, temp); + } + } + + return 0; +} + +static const struct thermal_zone_of_device_ops tegra_of_thermal_ops = { + .get_temp = tegra_thermctl_get_temp, + .set_trip_temp = tegra_thermctl_set_trip_temp, +}; + static int get_hot_temp(struct thermal_zone_device *tz, int *trip, int *temp) { int ntrips, i, ret;