From patchwork Thu Nov 30 09:17:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 10084461 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 BA7DE6035E for ; Thu, 30 Nov 2017 09:18:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1E4829F17 for ; Thu, 30 Nov 2017 09:18:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6FBA29F19; Thu, 30 Nov 2017 09:18:59 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham 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 3D5DC29F17 for ; Thu, 30 Nov 2017 09:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751958AbdK3JSC (ORCPT ); Thu, 30 Nov 2017 04:18:02 -0500 Received: from antares.kleine-koenig.org ([94.130.110.236]:36736 "EHLO antares.kleine-koenig.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751851AbdK3JRn (ORCPT ); Thu, 30 Nov 2017 04:17:43 -0500 Received: by antares.kleine-koenig.org (Postfix, from userid 1000) id 5077336748; Thu, 30 Nov 2017 10:17:42 +0100 (CET) From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Leonard Crestez , Shawn Guo , Zhang Rui , Eduardo Valentin Cc: kernel@pengutronix.de, linux-pm@vger.kernel.org Subject: [PATCH v2 1/4] thermal: imx: Use better parameter names than "val" Date: Thu, 30 Nov 2017 10:17:35 +0100 Message-Id: <20171130091738.8901-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171130091738.8901-1-u.kleine-koenig@pengutronix.de> References: <20171130091738.8901-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 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 The values passed to imx_init_calib() and imx_init_temp_grade() are read from specific OCOTP values. Use their names (in lower case) as parameter name instead of "val" to make the code easier to understand. Signed-off-by: Uwe Kleine-König --- No changes since (implicit) v1, sent with Message-ID: 20171121200225.23316-2-u.kleine-koenig@pengutronix.de Leonard Crestez had doubts because on i.MX7 the OTP registers are called differently, but I ignored these as the driver up to now only supports i.MX6. --- drivers/thermal/imx_thermal.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index e7d4ffc3de7f..21b8c4c4da3c 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -347,13 +347,13 @@ static struct thermal_zone_device_ops imx_tz_ops = { .set_trip_temp = imx_set_trip_temp, }; -static int imx_init_calib(struct platform_device *pdev, u32 val) +static int imx_init_calib(struct platform_device *pdev, u32 ocotp_ana1) { struct imx_thermal_data *data = platform_get_drvdata(pdev); int t1, n1; u64 temp64; - if (val == 0 || val == ~0) { + if (ocotp_ana1 == 0 || ocotp_ana1 == ~0) { dev_err(&pdev->dev, "invalid sensor calibration data\n"); return -EINVAL; } @@ -364,7 +364,7 @@ static int imx_init_calib(struct platform_device *pdev, u32 val) * Use universal formula now and only need sensor value @ 25C * slope = 0.4297157 - (0.0015976 * 25C fuse) */ - n1 = val >> 20; + n1 = ocotp_ana1 >> 20; t1 = 25; /* t1 always 25C */ /* @@ -392,12 +392,12 @@ static int imx_init_calib(struct platform_device *pdev, u32 val) return 0; } -static void imx_init_temp_grade(struct platform_device *pdev, u32 val) +static void imx_init_temp_grade(struct platform_device *pdev, u32 ocotp_mem0) { struct imx_thermal_data *data = platform_get_drvdata(pdev); /* The maximum die temp is specified by the Temperature Grade */ - switch ((val >> 6) & 0x3) { + switch ((ocotp_mem0 >> 6) & 0x3) { case 0: /* Commercial (0 to 95C) */ data->temp_grade = "Commercial"; data->temp_max = 95000;