From patchwork Tue Oct 10 18:02:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 115428 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4039288qgn; Tue, 10 Oct 2017 11:05:24 -0700 (PDT) X-Received: by 10.99.168.13 with SMTP id o13mr13152946pgf.435.1507658723924; Tue, 10 Oct 2017 11:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507658723; cv=none; d=google.com; s=arc-20160816; b=Tu7GpZ9qB172N/PIDGjRvFMkyLyNcX/CirwCPpn5KGZBaUvyKB91cArIj+eKHPSsKR FvT33rw9NrER+TCeDJrdxzHdfQdz1aUGs2FhURSjNjWJXWoxE/DUrbH0ThpWamZqRFpN zlhvmfdOGLc8oXOL/K3W7i4yNBlilV+9mgPMgVs5Syo9umU+VSz4tpi8nNy/lEbGPoWd 9NL6seqMk+HXG2wcy2QNWMdJj8elr7pDvviNg2+hAbS/K5K7JVCuZGevt92HMHMHbHo/ bRG33r1ydmCa17SMU/tgDOSIlJ418ZViktGRc5XAErrO97PcbfbQ/I1eBLpyBwcOfbA7 K2Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=LVMPc6PvZ///EJBUOnr5Vy8p3tP3rB0lSv32gwuCQuc=; b=rswY1F1MHxYg7F5I244tZd4tVWK/AsZ6cttMa//KMIYQU7EevrOplA9OJma7JH2DyZ UlCgYincVJBtRhXaCEZ9w13NmfWZA11rUpC47bwGxTbhn4jUbYW2QQ8Sbcn/ClisTaCk s9gjc7KDW37Ukslrc6+lyRkjG1AG0QuDDZTjR4JFYRzx2cOs4ahrro2GOSIsXY+/iuD8 Z/cHwbXlfJK8pHWwI11OB8bCdiSoJ2Awgk7fsSzofHBul9EQkafGSZd2mrFkpYXZEXNo gccsTHBrjvSJ8rKSOx+SUmO1Jo93USWKfhPIl84lryK6lUaR0T7K2IqA/dIIOBBzsMkn yqPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a/DfNW8P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si8828206plp.584.2017.10.10.11.05.23; Tue, 10 Oct 2017 11:05:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a/DfNW8P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932688AbdJJSFV (ORCPT + 26 others); Tue, 10 Oct 2017 14:05:21 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:53042 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932663AbdJJSFS (ORCPT ); Tue, 10 Oct 2017 14:05:18 -0400 Received: by mail-wm0-f41.google.com with SMTP id k4so7703889wmc.1 for ; Tue, 10 Oct 2017 11:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LVMPc6PvZ///EJBUOnr5Vy8p3tP3rB0lSv32gwuCQuc=; b=a/DfNW8P1tovMNLWzW0/v2pMZ49Oca1cunJAzA1vc8byWUFffm0/C3dxm786UazgWP 6T052iIpR4g4ay8HAlM+obNmKq4MpJH6h47vEkQ5YX1qgRl7op1TgB/CSF5jPLk46S1Y uMxFEHc2OXns7/9tzBzbCczKl56bsUv0ImmII= 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:in-reply-to :references; bh=LVMPc6PvZ///EJBUOnr5Vy8p3tP3rB0lSv32gwuCQuc=; b=g11lMIOfPYHS8HtXKD/cAePSVnnNfzpLDJlDwEPZGkC7i7OEZRptL0oV1YLf5YjZWp q+BoSnMaCdz9CtN0Byc3bt8YoBi2WV/qOOY8PrV/hnVtCuNzZp6nfyXGbFs9UNW8uBrJ 4FFwMoD0RP5PeA1E9wL1w5ukfNGzsNh0Fd99Gfu5bvUaDy01hoR40Q0k6P/pB6ByBLAq I46vx5Wf64AM+j0tdP8xGs1yEwOkspe4cuNVA5rGYwchL5jzUvnDdJ9dILIgj4Gld3Xj d4yMFT/qzcQj536a3MLBSNN8Ru5BS8yw3KeqvjuEZzW1BfYCVuA7ll7/BmHyOaik/lIu TGnw== X-Gm-Message-State: AMCzsaULVIQfXUS34xwSFLvROpYS4Fb5Rr9VIEKfi0QcSGXonWOxmja/ T87REBy/g9IO0RT7TTq0s93EUA== X-Google-Smtp-Source: AOwi7QBOYRbcoDOOSHGqPwySQfRrr8+AYNw8AAUTWTGfayl7fycZdziIIvqm1wu3d1c8v+gy0W/PjA== X-Received: by 10.28.175.197 with SMTP id y188mr10644587wme.20.1507658716825; Tue, 10 Oct 2017 11:05:16 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:4f9:3ae1:43d2:31ae]) by smtp.gmail.com with ESMTPSA id l73sm12513428wmd.47.2017.10.10.11.05.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Oct 2017 11:05:16 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kevin.wangtao@linaro.org Subject: [PATCH 19/25] thermal/drivers/hisi: Put platform code together Date: Tue, 10 Oct 2017 20:02:44 +0200 Message-Id: <1507658570-32675-19-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507658570-32675-1-git-send-email-daniel.lezcano@linaro.org> References: <79a5f10c-0fb7-3e4f-caac-c1625904b137@linaro.org> <1507658570-32675-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kevin Wangtao Reorganize the code for next patches by moving the functions upper in the file which will prevent a forward declaration. There is no functional change here. Signed-off-by: Kevin Wangtao Signed-off-by: Daniel Lezcano --- drivers/thermal/hisi_thermal.c | 76 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index befdb28..ff9055a 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -201,6 +201,44 @@ static void hisi_thermal_disable_sensor(struct hisi_thermal_data *data) clk_disable_unprepare(data->clk); } + +static int hisi_thermal_setup(struct hisi_thermal_data *data) +{ + struct hisi_thermal_sensor *sensor = &data->sensor; + int ret; + + /* enable clock for tsensor */ + ret = clk_prepare_enable(data->clk); + if (ret) + return ret; + + /* disable module firstly */ + hisi_thermal_reset_enable(data->regs, 0); + hisi_thermal_enable(data->regs, 0); + + /* select sensor id */ + hisi_thermal_sensor_select(data->regs, sensor->id); + + /* setting the hdak time */ + hisi_thermal_hdak_set(data->regs, 0); + + /* setting lag value between current temp and the threshold */ + hisi_thermal_set_lag(data->regs, HISI_TEMP_LAG); + + /* enable for interrupt */ + hisi_thermal_alarm_set(data->regs, sensor->thres_temp); + + hisi_thermal_reset_set(data->regs, HISI_TEMP_RESET); + + /* enable module */ + hisi_thermal_reset_enable(data->regs, 1); + hisi_thermal_enable(data->regs, 1); + + hisi_thermal_alarm_clear(data->regs, 0); + hisi_thermal_alarm_enable(data->regs, 1); + + return 0; +} static int hisi_thermal_get_temp(void *__data, int *temp) { struct hisi_thermal_data *data = __data; @@ -291,44 +329,6 @@ static void hisi_thermal_toggle_sensor(struct hisi_thermal_sensor *sensor, on ? THERMAL_DEVICE_ENABLED : THERMAL_DEVICE_DISABLED); } -static int hisi_thermal_setup(struct hisi_thermal_data *data) -{ - struct hisi_thermal_sensor *sensor = &data->sensor; - int ret; - - /* enable clock for tsensor */ - ret = clk_prepare_enable(data->clk); - if (ret) - return ret; - - /* disable module firstly */ - hisi_thermal_reset_enable(data->regs, 0); - hisi_thermal_enable(data->regs, 0); - - /* select sensor id */ - hisi_thermal_sensor_select(data->regs, sensor->id); - - /* setting the hdak time */ - hisi_thermal_hdak_set(data->regs, 0); - - /* setting lag value between current temp and the threshold */ - hisi_thermal_set_lag(data->regs, HISI_TEMP_LAG); - - /* enable for interrupt */ - hisi_thermal_alarm_set(data->regs, sensor->thres_temp); - - hisi_thermal_reset_set(data->regs, HISI_TEMP_RESET); - - /* enable module */ - hisi_thermal_reset_enable(data->regs, 1); - hisi_thermal_enable(data->regs, 1); - - hisi_thermal_alarm_clear(data->regs, 0); - hisi_thermal_alarm_enable(data->regs, 1); - - return 0; -} - static int hisi_thermal_probe(struct platform_device *pdev) { struct hisi_thermal_data *data;