From patchwork Wed Jul 13 14:56:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Bilbao X-Patchwork-Id: 590216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56EE3C43334 for ; Wed, 13 Jul 2022 14:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236635AbiGMO6A (ORCPT ); Wed, 13 Jul 2022 10:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236636AbiGMO57 (ORCPT ); Wed, 13 Jul 2022 10:57:59 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 126663E768; Wed, 13 Jul 2022 07:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U0Eix/FC8mhhlcZzd0xCypKPaV3jj4DsOwYQdM4j0pwZpZezeUXwI1aZrD/Dc/rQv9mIha0G6QyqEbe1YsFK683de2mPw47sz4YU6zZuQVLsAOrHVqEHm+guIdh9DAr7BDTgi2+p02a9Cq5aXQ/sfe8dGTZGE1TdBnemdvGqWfYXcE9XEn0ASOwgKGT2AyOsO5InvaiF7BmBVsj+BlPPFpTZipv2exkcnH4KE3xZdVZy263tm+ndn+YGWYzyEskwM1HAsgzR7Wni/CvRiTY2iXp2v+Tw7s2dF+DM8AR0PF99MAQkSjyfBQCOJGCCJf0bLc+kECSS/5OyjgW8zPnbDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=++kOoW67RSqz7nqztfDjATV3bfaRnMfsB2BuChyA0P8=; b=MN997RxIisMcFj0fXbODemwnAnPGe7k01SVypGrO/JvIeuk9Qe/EoLlM4ye5ITt3H5EOl9jHbzpS46oxs2qKuHB7chikOvFOowL7nAGpROm2cgzTncGiRUxRuAnRs9NAxuDFR698cCZkGj7GJYfOzpcTSLllfo08DT5Vs8FlFMkz6Tn1tHuR1Is5QVnxCMqHx4u+9FwS3g4Yo5CJM8fssGYCcISTSqdTmbdEXLGNMfwBikGYPLn99Znu9MDdqRZlSKJHgGW9e5u15sTnE72PM/+W7XVDYlmbrN9Brh7E6GLLScZ720sUensgZTwjbAEX6s3d/2ZD7JYiMNXpZ2WaQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=++kOoW67RSqz7nqztfDjATV3bfaRnMfsB2BuChyA0P8=; b=B+QfpeocPXliZt/wSqm4CXsjKgkXNgZe6bROikPrgqCLenfAW/ovDNY6rdOFkOmKNG4/wu9nf08MoRe6axecdqWIOlGmBPHkGQ+nSnrDp/pq5HxoDbMMB9gcex3WvybW0d14ukCYDi5NGH4BnMMlhlYGLzbIEBRE58vHklgm3y0= Received: from DS7PR03CA0015.namprd03.prod.outlook.com (2603:10b6:5:3b8::20) by DM6PR12MB3722.namprd12.prod.outlook.com (2603:10b6:5:1c3::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Wed, 13 Jul 2022 14:57:55 +0000 Received: from DM6NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b8:cafe::64) by DS7PR03CA0015.outlook.office365.com (2603:10b6:5:3b8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.13 via Frontend Transport; Wed, 13 Jul 2022 14:57:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT020.mail.protection.outlook.com (10.13.172.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5438.12 via Frontend Transport; Wed, 13 Jul 2022 14:57:55 +0000 Received: from ethanolx1ade-milan-genesis.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 13 Jul 2022 09:57:47 -0500 From: Carlos Bilbao To: , , , CC: , , , , , , Carlos Bilbao Subject: [PATCH 1/4] thermal/drivers/qcom: Simplify returns for tsens-8060.c Date: Wed, 13 Jul 2022 09:56:54 -0500 Message-ID: <20220713145655.3844109-2-carlos.bilbao@amd.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220713145655.3844109-1-carlos.bilbao@amd.com> References: <20220713145655.3844109-1-carlos.bilbao@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9002a393-6a6c-4a0c-0417-08da64e011ae X-MS-TrafficTypeDiagnostic: DM6PR12MB3722:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Avix2aQXciFNcbEtU+OXI4I28YuCoHvf8JBSc7anBiUA442xjMm1wnoXsoGMJ4h7IyM9vGIZNI04osLz4+X5T7Ovv7vGZDjNrT7S0pmLx7yQZ8LiemSmBRDuVZGG/JNuFHJZJm4o6+/97Mf+fYojHxJOwYscL4isGUXR01v2uahgUyo0j19tjFMaoJq6IMuFD/b8xNr/L2X6QThA+4jT04xICbJlUROj7Vt2K9zddXfmlv5UK0q8T5nWdr0EyzZPmSVaxU7wVc0UXaS5w3/wTggfwBTG/orH9JtV6mnP+rdrDn/gULz3uUEGh6eAGvCvHoRb2J3Gk3XxbwTw1Qt6DhpHjuSMGKlfqZ1/mauW8GCDBSUKX49IySqO1m+ThjSInzcK4LM4gVG6KOYuWfv0cyFF3eNAIYCeDomu/b1PbXigF/DlTCbBcKfcqSfAxDnGPBrHDswJIvTgSe6KypuCoROi6zveXdtOrEqObPUz4VXUnCnbNdX21FYw0mNIvxxt5J9GvSVuJJGfQrfBMLkyi0lE20kuCwyVqdsA4u3B8GjI3n3y6xEtF1vZY3zj+anzLd/ZdzDEDeUSTsV7otD9HLFWdCIvRmsoHy1go7wzipfw/qhbRqOyiyxw3OCUTtu1fLvYVtVEDVaWoCyDPJVXXPClj4ejzrljMJ/aY28i70dUGClpFOpaEGUR5U3KYgcfg+3WFUjgSwPmzN8gjbihVGV/TDpbKeQozxh3nBKAG8ENkSEyDHCAhdigFQu8WSOieTr7GtFNRe/E/jDXmXK4Nn0wNiIVI8nyK1jbuB2uyRo0h0Bw5R6jRt2/HzIrGSoRPoLHrDZhCHXJzrX4Srl3jMBB3h5Er+zLbGZlHOqcStI= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(396003)(39860400002)(346002)(376002)(136003)(40470700004)(36840700001)(46966006)(356005)(54906003)(7696005)(81166007)(16526019)(426003)(44832011)(4326008)(47076005)(36756003)(110136005)(70586007)(8676002)(336012)(70206006)(82740400003)(82310400005)(36860700001)(316002)(2616005)(83380400001)(5660300002)(8936002)(1076003)(86362001)(40480700001)(2906002)(41300700001)(7416002)(26005)(478600001)(186003)(6666004)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 14:57:55.7321 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9002a393-6a6c-4a0c-0417-08da64e011ae X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3722 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Simplify return logic in file tsens-8060.c. Signed-off-by: Carlos Bilbao --- drivers/thermal/qcom/tsens-8960.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c index 8d9b721dadb6..f4fc8a1c161e 100644 --- a/drivers/thermal/qcom/tsens-8960.c +++ b/drivers/thermal/qcom/tsens-8960.c @@ -75,11 +75,7 @@ static int suspend_8960(struct tsens_priv *priv) else mask = SLP_CLK_ENA_8660 | EN; - ret = regmap_update_bits(map, CNTL_ADDR, mask, 0); - if (ret) - return ret; - - return 0; + return regmap_update_bits(map, CNTL_ADDR, mask, 0); } static int resume_8960(struct tsens_priv *priv) @@ -105,11 +101,7 @@ static int resume_8960(struct tsens_priv *priv) if (ret) return ret; - ret = regmap_write(map, CNTL_ADDR, priv->ctx.control); - if (ret) - return ret; - - return 0; + return regmap_write(map, CNTL_ADDR, priv->ctx.control); } static int enable_8960(struct tsens_priv *priv, int id) @@ -131,11 +123,7 @@ static int enable_8960(struct tsens_priv *priv, int id) else reg |= mask | SLP_CLK_ENA_8660 | EN; - ret = regmap_write(priv->tm_map, CNTL_ADDR, reg); - if (ret) - return ret; - - return 0; + return regmap_write(priv->tm_map, CNTL_ADDR, reg); } static void disable_8960(struct tsens_priv *priv) @@ -205,11 +193,7 @@ static int init_8960(struct tsens_priv *priv) return ret; reg_cntl |= EN; - ret = regmap_write(priv->tm_map, CNTL_ADDR, reg_cntl); - if (ret) - return ret; - - return 0; + return regmap_write(priv->tm_map, CNTL_ADDR, reg_cntl); } static int calibrate_8960(struct tsens_priv *priv) From patchwork Wed Jul 13 14:56:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Bilbao X-Patchwork-Id: 590721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5041ECCA479 for ; Wed, 13 Jul 2022 14:58:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236647AbiGMO6A (ORCPT ); Wed, 13 Jul 2022 10:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236640AbiGMO57 (ORCPT ); Wed, 13 Jul 2022 10:57:59 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061.outbound.protection.outlook.com [40.107.244.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7537E3ED56; Wed, 13 Jul 2022 07:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WitwXtGDwviL5qwCjyCNhKLWzUsn37z0W9773db55Y0+HuPzq+VtDNRe03jv9aT4SyzgwJf6A0tmKyxLW+qM5Zm1bzQ9MLhCbnWFCnZW5Hn4LSB5amPLg5rqbsIXUNzTMxR3wuKomGxF8nVNuPrR7o+x7Y1Kcaon0Q7Mo1/p8A3LV4YsEAHvaOO+xub49wawgrW3vuKXlJo9X7SXPKsFdxeRl4xnYexb753vQvb+tgni8q6x9Hoif49d1RgSidYCmWr15B2/Mb9VpGoH0qg/VguygZIZglgtVx0Imv3mEvp6C9nzXO/LQ4+yQ0uqCYbYvzaq3hpKrwkkCQLNdrNW0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Es89HGwt+uihZ4zm0WLrkQ4yN5Eo/iXCgmqy3hdJmMc=; b=em8azqmFu0TS4rUkIXkoFToR8SpoA5oB+IbIPFz2zHEKeqZ+1tHD8LkALHXxE4BUQamfynHfjsoPWVGF3Qg/g3nQATV5aXw6+fAC2UcDRkCdCYXxFv/dhldCakRp4tSG+imYDQ8JoCIaUostVG1p1B1+4MNOFu+jGIdfWO04YtxqlYwIOcWDJHRq/Lzfu+t9SGeEp+H7jc+on21W2qWUCz9kSLA9s+TW8IYrvnrd723xo6gQIYTaxGzx7UUacW2y0MFqc90I04DaybYP048PXvW3r2wwE33GIMM6cw3/lmj/sSol9WKpo8GRbP56lYY84rGsAYp/hKTLs6WVu5ktsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Es89HGwt+uihZ4zm0WLrkQ4yN5Eo/iXCgmqy3hdJmMc=; b=tz+OqteQVJwlHlA73iNWBc8x9vBs+ZIYuTf2PT6ca1LRvGyBjnseb8ToHJqvxzN/QfedXg6w+bQQm5khNq/WfdEIs81N+O9GXJIE19jmgiQiqRPj02HVgIN9J+WYYgttpALYTYmBvXNw9KrAGMiW3ScggUPEvL1YD8DTWSrJUbo= Received: from DS7PR03CA0024.namprd03.prod.outlook.com (2603:10b6:5:3b8::29) by MW4PR12MB5625.namprd12.prod.outlook.com (2603:10b6:303:168::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Wed, 13 Jul 2022 14:57:56 +0000 Received: from DM6NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b8:cafe::f3) by DS7PR03CA0024.outlook.office365.com (2603:10b6:5:3b8::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12 via Frontend Transport; Wed, 13 Jul 2022 14:57:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT020.mail.protection.outlook.com (10.13.172.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5438.12 via Frontend Transport; Wed, 13 Jul 2022 14:57:56 +0000 Received: from ethanolx1ade-milan-genesis.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 13 Jul 2022 09:57:55 -0500 From: Carlos Bilbao To: , , , CC: , , , , , , Carlos Bilbao Subject: [PATCH 2/4] thermal/drivers/qcom: Simplify function code_to_degc() Date: Wed, 13 Jul 2022 09:56:56 -0500 Message-ID: <20220713145655.3844109-3-carlos.bilbao@amd.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220713145655.3844109-1-carlos.bilbao@amd.com> References: <20220713145655.3844109-1-carlos.bilbao@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b2a09859-e9c9-41d7-2512-08da64e01212 X-MS-TrafficTypeDiagnostic: MW4PR12MB5625:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m30Y1xiU2SgvXJFie4Osi7N0LpHqiGgMASATh/vyMGf+1pt84QcTKl5IiTRyg+FRpkCoA72qD+ZoDSRcx5D0HfHR1kLguWDvyb8RPgJu5h4XwQSB3ln4Jr3IaJ7mPvtGOWgDkfv7LAmgBWVW5omB/2QJmZNW/miVuXCcfsG/lUfiIEXhOpqnirhM5OFWgx3EdewS7uEaRzxqWVVIpWFJCBZaUNrOr/A3LZ6dTNJnX3EuRPDqEHYOaStXQWRiIvITMZ9tT+0LlqCkGLjwo4ze2C7D3xhbfnFObX8Gv3MrKxeH+AN08KvUIMxpm+TC7znHRublCqlB0lS+8WQbzNZBM6i9cFUO2AwU3HMQ56tGMG7IwHAc9C4UtKga59l5BFdKYiEZFyV99bV5YKgSTUfRz5kpNw/M8IDAH0sAGe313HkBTmMZVZPA2N4/by9hGKlcJYUr79CNVGuzPJftV/OjUfUhlFKVNL5Iagk4Vz1r7W/ttgXxchz0GV6RF5ZUI1obpNo918SgPzeKEBY1142NSrKSQ2WAdsaJcEwS5slXwHmGbgsWZurNk5e6FXszkJYubbB4iZLu5kXdoWaJuW/NiUBrt+5sMQxYI6Ktv1wn7Cg7cfvVWFS/SB9HNSHONnHRv88Fr4AHZV0gRWoDic7mpnHuBmYXc0yqETJsrDB4kD2inN1YaYB68IMurwi7y9TAQK0C7fbNwI7vzhC6BQ6nBzqsveIvsE0KE54tGTReCvYSL/WP8idw8u4uiby7eF9agZhG0i2ybLIR8/6GFPKygjuyA3605/SrpodUk0694+590ZijVBnMJk0D8qrQ87N12l2j+vjEYmNJI+RDfjP1If5LTNmWh+yPZmtV4byx+y4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(136003)(396003)(376002)(39860400002)(346002)(46966006)(36840700001)(40470700004)(26005)(70206006)(1076003)(186003)(4326008)(8676002)(7696005)(5660300002)(70586007)(82310400005)(7416002)(356005)(8936002)(316002)(2616005)(478600001)(40460700003)(16526019)(336012)(83380400001)(81166007)(2906002)(110136005)(36860700001)(44832011)(41300700001)(36756003)(40480700001)(82740400003)(426003)(86362001)(54906003)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 14:57:56.3883 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b2a09859-e9c9-41d7-2512-08da64e01212 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5625 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Simplify code_to_degc() so we don't need a third variable. Signed-off-by: Carlos Bilbao --- drivers/thermal/qcom/tsens-common.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 528df8801254..492b0e9cc2a2 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -66,21 +66,18 @@ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1, static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s) { - int degc, num, den; + int num, den; num = (adc_code * SLOPE_FACTOR) - s->offset; den = s->slope; + if (!num) + return 0; + if (num > 0) - degc = num + (den / 2); - else if (num < 0) - degc = num - (den / 2); + return (num + (den / 2)) / den; else - degc = num; - - degc /= den; - - return degc; + return (num - (den / 2)) / den; } int get_temp_tsens_valid(struct tsens_priv *priv, int i, int *temp) From patchwork Wed Jul 13 14:56:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Bilbao X-Patchwork-Id: 590215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A70CC433EF for ; Wed, 13 Jul 2022 14:58:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236676AbiGMO6T (ORCPT ); Wed, 13 Jul 2022 10:58:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236660AbiGMO6Q (ORCPT ); Wed, 13 Jul 2022 10:58:16 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2089.outbound.protection.outlook.com [40.107.223.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BE953ED6C; Wed, 13 Jul 2022 07:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kEdSssu+hwuZWem6NAbds1rweQ8IHuYgLi3pgTp/syhzmr2AZBbTWYAi/qE3ufStTeiwy8g81CUYzUO68SvGX+EUyKhQzuLDvR46atedeTKJ6Mhn3YqOvzgCcvCmVLkt6xM94cAVlaIRnla0FK840vaHYA+GH4L3g9CkQ8qekR89dpC7NnJS7pPXeDZMyiaP2Tt5TZOdseDfI3I2jb6TXoKh43Z2k6I4V++csM1mHXxFPKNgYubUad3kO0TPYMyWm+l38ODhVbf2cUycHUqz4V5ZUvuiPfhtRDd0/0WAjgUW3VTonwD/1AHhivBOtYAbUQkUdZ9iwUik/SoRVB16MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vsMYZT9ZGage1XOGx8Qbmm4a9oY0jhH71JzfXIWycu8=; b=bCFx5xs+T3a1UeE+IHw0WSzG1UWmf2+I7etFYOU80vU+CyaeIdqdy0ZhUOQYO0KawwuUffyRKgJonQAB/o0N75wJIKN8TizLIEQ7LjyVGVo5OS9yQcajBduYuuo49IKIE8NNwHRo2kqSNCkMkaqkbJ6tRm4/uoxWg4gzjJLkIMEABxBjkcMbpyHCPEJCKlyyF/+6YaFrdwsnSeVMUKVJAr7vzJjrLH546vnSS66EKYI4hMydCs7F4AfJbcLkMHEz6awG5LZL3Rgu6o/asMXBOkmJZOPfUIIcuT9e6VFXKyCtJsOvxBEJ+gkKRfOJZYm7n2nlx+/m/A3w0Be7e5zXxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vsMYZT9ZGage1XOGx8Qbmm4a9oY0jhH71JzfXIWycu8=; b=WnjPomL7v+3Upfn16hmFAiEDZHYvzxcPnOq0ngOScroKn6HU7MdZGkD2hqw58snIY0JYenB4FPXPN0VuEnSCo2SLGolSwZbaxF2AU29Bol2SXpcprMzsIV2FWRGWLPdfJQ4iCgG4F9BJvwycvHzXHZemRJ1aHzZYWGMNz8BbZwQ= Received: from DS7PR03CA0185.namprd03.prod.outlook.com (2603:10b6:5:3b6::10) by DS7PR12MB6119.namprd12.prod.outlook.com (2603:10b6:8:99::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.25; Wed, 13 Jul 2022 14:58:07 +0000 Received: from DM6NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b6:cafe::61) by DS7PR03CA0185.outlook.office365.com (2603:10b6:5:3b6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20 via Frontend Transport; Wed, 13 Jul 2022 14:58:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT036.mail.protection.outlook.com (10.13.172.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5438.12 via Frontend Transport; Wed, 13 Jul 2022 14:58:07 +0000 Received: from ethanolx1ade-milan-genesis.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 13 Jul 2022 09:58:06 -0500 From: Carlos Bilbao To: , , , CC: , , , , , , Carlos Bilbao Subject: [PATCH 3/4] thermal/drivers/qcom: Simplify function calibrate_8960() Date: Wed, 13 Jul 2022 09:56:58 -0500 Message-ID: <20220713145655.3844109-4-carlos.bilbao@amd.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220713145655.3844109-1-carlos.bilbao@amd.com> References: <20220713145655.3844109-1-carlos.bilbao@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dbe2d4d9-4791-436e-0f81-08da64e018cf X-MS-TrafficTypeDiagnostic: DS7PR12MB6119:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mp5DqeG5H8XYu+qtcEvTXWadadC2AIrfiU0zv8D+MOx8PYvaTxBfnVaFhMjLlVXWSR83MB+ZRiiqC4RU6t1ZhVBapvMGUXs11DDlkyxCVZUO5LRBs40StZBOrewO/Z9gE0Q0on8+s0Aa67M7CMexm/2JnaSI+8DQ39kFiKSTq3nLULbftQM7kSuPdIvc+lh/POmvZ8E9a924xDBQvSpbSTBGQB0GfwuzcgofSkP/b/uofFIWJ9d53gNcvqrKML2g1dTASLseoW97e33fy0ii+PldikowaiwBBy6eFmuJ/KZqK/woHz9SWlEF3CZkt2GpLgX0DYBuhAuIJQp6IVNhik4rIxul5nb5slD04wMlHRRGnhoQgU9vGHJY4qKoEU0IefZYYW6XLRDqSvWWFXRxJNHDDFFlpOdhlTwVnekKOVU3Z6G/kWayE9PARL2HaV3HFh3S9s7SX5oM6GjDAoh/0JsPVqoWDvkBpVw/3ANCU6PfhGeulkE2dfmWL9vXK55AatZk3mLEO+jYsED4p1+LKHcsQVDynG7FyUP8lrfDEuyn0wQHEi1bTtvTrHdnoFTRoftIwjaDpUmgPSagqq+DHrBYNx1NL6lGAaQrHTOyp8yzQFGnxjHtLzIK++Mwg2+gPBqNa2/dC0ktydXlrKK26Vh0RiLGEG4AB3FDYd124HJ2TQERElfhjGSjT4sfxEuB3t2Yki4W6aC8PZZDzMWZvECphUEkraJusoa42wZgmpIZpW6b3vlRm7MHbIDYI0fYkvMm4I4srLooLF4wEny+ZaXst23qkQix0aN2G3x07QhXeI3xFyo4Jp1iwrXcCBCZWvly/U5VP2fhv0qFA4q/N3japuLjVbFq/hV90L5X4r0= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(376002)(396003)(346002)(136003)(39860400002)(46966006)(36840700001)(40470700004)(83380400001)(478600001)(4744005)(86362001)(16526019)(356005)(36756003)(44832011)(336012)(2616005)(70206006)(4326008)(54906003)(82740400003)(316002)(8676002)(70586007)(47076005)(426003)(186003)(36860700001)(82310400005)(81166007)(110136005)(41300700001)(2906002)(26005)(40480700001)(8936002)(1076003)(5660300002)(40460700003)(7416002)(7696005)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 14:58:07.6927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbe2d4d9-4791-436e-0f81-08da64e018cf X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6119 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Simply function calibrate_8960() so a second check to IS_ERR(data) may be avoided. Signed-off-by: Carlos Bilbao --- drivers/thermal/qcom/tsens-8960.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c index f4fc8a1c161e..b41ff164e67a 100644 --- a/drivers/thermal/qcom/tsens-8960.c +++ b/drivers/thermal/qcom/tsens-8960.c @@ -205,10 +205,11 @@ static int calibrate_8960(struct tsens_priv *priv) struct tsens_sensor *s = priv->sensor; data = qfprom_read(priv->dev, "calib"); - if (IS_ERR(data)) + if (IS_ERR(data)) { data = qfprom_read(priv->dev, "calib_backup"); - if (IS_ERR(data)) - return PTR_ERR(data); + if (IS_ERR(data)) + return PTR_ERR(data); + } for (i = 0; i < num_read; i++, s++) s->offset = data[i]; From patchwork Wed Jul 13 14:57:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Bilbao X-Patchwork-Id: 590720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C029CC43334 for ; Wed, 13 Jul 2022 14:58:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236694AbiGMO6i (ORCPT ); Wed, 13 Jul 2022 10:58:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236707AbiGMO6b (ORCPT ); Wed, 13 Jul 2022 10:58:31 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2059.outbound.protection.outlook.com [40.107.220.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CC20419B2; Wed, 13 Jul 2022 07:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ALA4EWdRiXv8ErYcvfTHwWZvqMklUQKx4RWY4JyP2pPWPeBFNUv20QUHmlZwkrq8RWAmCzy5xQx7yhstozG6Zn/lk4BD6bn3O4ynq0WExtLPOLgigqnbp0NkDGJV3XpKHLZr+gGUVVWcaySUIjFwQiBH5HsSCRfM4kj06awcs6TJPcQoSJXlAzT04F0WUSqy7RHUjflmPmICxa8KSPUnMaxrQEa2wz9+Y7fHRwIaYLni5EGOuF6q0z6H/c4PH9yizhkeBIt/ztqUlwpKX/FfuEMpz4wJHQPXWqnkWvlDimjNcgmauSDEj1bZAH//akcu4wujvPiDZTIWb8AF+hwWEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=diQdm2KDwFrNgipgryT/9yJmjcRWjiYaN9Y8qF5NA5o=; b=aCWNbOabwld0PBXhgf20ER4e3YhvdRDAnotjP+t71IYXghdXCPee+b7AXrB/E19iPO5krmzA3H48LKGvQ5baLDnpWIky+WNIDg2z34dqe3rOq++OkwonwY3esmSQbL2bF7LRYh4MdVziqgBelNT2jvmTTHxXW16+Jj0eWhDkw0cqP/UPj6DnbCwPLoLudFfLddV+Cr9t2fhvNFde2YkytJ6EF/zfWM5EhBMgiisG21Eq/Dp2nqTSZxMTlhHpSMP75u+4RBYFtar3DDpsmH0TuE1brIIuSZStUyj311Zyolcaat7mpEvMpr8E7mLy99VdvMyc04t5wLB4cQDLEUrIjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=diQdm2KDwFrNgipgryT/9yJmjcRWjiYaN9Y8qF5NA5o=; b=lfuuNw6BAZUcO5OFzwi7QFkriIJ7ZgH/SdMkXhuRIKe192okH42uzlAGrI7gFcOvwZuu2TgmVmW7NBryafDL4tAUAwinKGwISy9sHI/4w8XbPWJN5OQyYKG4civTG41iJ6HDQ98+c0BBivoL9rD2H0xfQIPUi5AWiX+K9hkajbo= Received: from DM5PR07CA0051.namprd07.prod.outlook.com (2603:10b6:4:ad::16) by DM6PR12MB3210.namprd12.prod.outlook.com (2603:10b6:5:185::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.17; Wed, 13 Jul 2022 14:58:19 +0000 Received: from DM6NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ad:cafe::fb) by DM5PR07CA0051.outlook.office365.com (2603:10b6:4:ad::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.23 via Frontend Transport; Wed, 13 Jul 2022 14:58:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT010.mail.protection.outlook.com (10.13.172.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5438.12 via Frontend Transport; Wed, 13 Jul 2022 14:58:19 +0000 Received: from ethanolx1ade-milan-genesis.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 13 Jul 2022 09:58:18 -0500 From: Carlos Bilbao To: , , , CC: , , , , , , Carlos Bilbao Subject: [PATCH 4/4] thermal/drivers/qcom: Use array for max num sensors per version Date: Wed, 13 Jul 2022 09:57:00 -0500 Message-ID: <20220713145655.3844109-5-carlos.bilbao@amd.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220713145655.3844109-1-carlos.bilbao@amd.com> References: <20220713145655.3844109-1-carlos.bilbao@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 425109d8-74cd-4397-93e9-08da64e01fc6 X-MS-TrafficTypeDiagnostic: DM6PR12MB3210:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Yk1qFl3HLa144NCBLzaUfZaEGQYwBO4jw5uliSNMAzqPz5FzbnwoWRb/33AFdjgO/UnUzuD+qbG+EaeGsVeo5+9m+8QoumUdPBFvmAPkaOua9RCbRZF0znfxKu7H4oIq7XNOq++EhTGDhz/tmub/3qwL6RFW6IcKS3qoVg+AhuMgS+m+3Kd8U+gKjuZt+LI9/dn5LpqPTtq//lDjC9uBPXt6ffonCpeotkZiNRMTpETZ0kreglvy42DpAPJu5Yesk0qJiaiWeLIhUXm6SXxAxlhbRcb6/Fpe81Ij5Ahhe3HiUCYDpJBTC6y27ENnaKmYwGQCuJ3Mi/o+ofiyTWKLJ+LfjLNdE+6IOGEeX6nOfgAokwDrHcGizJC+5t7hTqpS2oRFOVJD2ha3G7LgWz2pFyEwjdZoFqK4DPWMo/o6C5A/H0lxsC/gPurupkJOvKE6Gc1NdPHIQjRMIfvKMQI5RRIIjoMMkZa+jueDoGWqRd1iaiRA2cyjMAooTRdopBYaghpe4E0KWtC10yQJ0sjTVF0HHJnbN5fjpSby0+qioodXK6mWqMZB1XAwT4vzVKVflpuPtvn3N2dHf9Hrl50Lx4DTjUORxniNmlSNk5ZHLXmF9pEtWOjcIZ4n+HB1s0YxdLRP3Lqp8GKdANyMNpngpiXyN3NiX3zffxMAmyaMuPPVaGmhHCqt+2zsMzlwNQ59lWaEY3WLW9xI00qfKUFzf0BycYy2zorWxJQD+Fdt/3ODtX6yirBld3UZs3ijzOeSaSWfbDVjHnRcbIjY+iP4M+pDWkQmXfVPwLAiaUx7+rlxoG2IHC8K5qhIlYVYhrhH/5xhvQOisVfcwnl7Bc5NNdS2j5JbChcT7tLOhKXP2h4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(346002)(136003)(396003)(39860400002)(376002)(36840700001)(46966006)(40470700004)(47076005)(336012)(40460700003)(5660300002)(54906003)(82310400005)(44832011)(186003)(16526019)(426003)(110136005)(36756003)(2616005)(86362001)(316002)(1076003)(2906002)(83380400001)(26005)(8936002)(478600001)(70206006)(7416002)(8676002)(41300700001)(7696005)(6666004)(36860700001)(40480700001)(4326008)(70586007)(81166007)(356005)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2022 14:58:19.3656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 425109d8-74cd-4397-93e9-08da64e01fc6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3210 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use a constant array MAX_NUM_SENSORS[] for maximum number of sensors per version (v0.1, v1, v2). Signed-off-by: Carlos Bilbao --- drivers/thermal/qcom/tsens-8960.c | 2 +- drivers/thermal/qcom/tsens-v0_1.c | 4 ++-- drivers/thermal/qcom/tsens-v1.c | 2 +- drivers/thermal/qcom/tsens-v2.c | 2 +- drivers/thermal/qcom/tsens.h | 6 ++++++ 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c index b41ff164e67a..05db9bf0e2c6 100644 --- a/drivers/thermal/qcom/tsens-8960.c +++ b/drivers/thermal/qcom/tsens-8960.c @@ -263,6 +263,6 @@ static const struct tsens_ops ops_8960 = { }; const struct tsens_plat_data data_8960 = { - .num_sensors = 11, + .num_sensors = MAX_NUM_SENSORS[VER_0_1], .ops = &ops_8960, }; diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index 6f26fadf4c27..d29046cffc6b 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -324,7 +324,7 @@ static const struct tsens_features tsens_v0_1_feat = { .crit_int = 0, .adc = 1, .srot_split = 1, - .max_sensors = 11, + .max_sensors = MAX_NUM_SENSORS[VER_0_1], }; static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = { @@ -374,7 +374,7 @@ static const struct tsens_ops ops_8974 = { }; const struct tsens_plat_data data_8974 = { - .num_sensors = 11, + .num_sensors = MAX_NUM_SENSORS[VER_0_1], .ops = &ops_8974, .feat = &tsens_v0_1_feat, .fields = tsens_v0_1_regfields, diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c index 10b595d4f619..2007deb45723 100644 --- a/drivers/thermal/qcom/tsens-v1.c +++ b/drivers/thermal/qcom/tsens-v1.c @@ -149,7 +149,7 @@ static const struct tsens_features tsens_v1_feat = { .crit_int = 0, .adc = 1, .srot_split = 1, - .max_sensors = 11, + .max_sensors = MAX_NUM_SENSORS[VER_1_X], }; static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = { diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c index 0a4f2b8fcab6..002809e6a0b5 100644 --- a/drivers/thermal/qcom/tsens-v2.c +++ b/drivers/thermal/qcom/tsens-v2.c @@ -32,7 +32,7 @@ static const struct tsens_features tsens_v2_feat = { .crit_int = 1, .adc = 0, .srot_split = 1, - .max_sensors = 16, + .max_sensors = MAX_NUM_SENSORS[VER_2_X], }; static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = { diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 2fd94997245b..39645bbe9f95 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -26,6 +26,12 @@ enum tsens_ver { VER_2_X, }; +static const int MAX_NUM_SENSORS[] = { + [VER_0_1] = 11, + [VER_1_X] = 11, + [VER_2_X] = 16, +}; + /** * struct tsens_sensor - data for each sensor connected to the tsens device * @priv: tsens device instance that this sensor is connected to