From patchwork Tue Aug 20 09:44:49 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Huan Yang
X-Patchwork-Id: 13769784
X-Patchwork-Delegate: daniel.lezcano@linaro.org
Received: from HK2PR02CU002.outbound.protection.outlook.com
(mail-eastasiaazon11010063.outbound.protection.outlook.com [52.101.128.63])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 939E218B473;
Tue, 20 Aug 2024 09:45:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
arc=fail smtp.client-ip=52.101.128.63
ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1724147110; cv=fail;
b=AtrMQkQ8r6pKmbO8/wZAlPTkXSjhesRW7M6Kq6Vt0m4QQKEcdGxifel+35v45l9/QJ7khf09fHw5m6lrVfyk3m17A4mVSDztlw9yyn07tuFCYuCgxXAT8eq5cU9bnpYKDCxBVHqJZCpSepgmL/JiOMnDawfK9i51CpwTZ/GM7rc=
ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1724147110; c=relaxed/simple;
bh=wrf4IIeunXv90WZPQy/hzon8M6zJYWcQzgYbIh5zFks=;
h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version;
b=D6UU383HckVSOysdjz2CtpHRTV83J6FEJg3unaz7OSoI7XgNQqY32NHcZ49y1/jCJJFL+OyeRd7QxUj5RzJEoCQ2HnBJKUAlo6fG9BiLq41iOYVdIfTFXpEzZDAT0r84WbnfGp0zQJlqJmN4kqSr24m68rE0PScC2sDoB1+nWV4=
ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dmarc=pass (p=quarantine dis=none) header.from=vivo.com;
spf=pass smtp.mailfrom=vivo.com;
dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com
header.b=cmZ9KJ32; arc=fail smtp.client-ip=52.101.128.63
Authentication-Results: smtp.subspace.kernel.org;
dmarc=pass (p=quarantine dis=none) header.from=vivo.com
Authentication-Results: smtp.subspace.kernel.org;
spf=pass smtp.mailfrom=vivo.com
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com
header.b="cmZ9KJ32"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=Y9GhxQPUk8k2sdwvdJ37EdpkSSC3oYrDoBne/o/IusYCv2KnbPNZnZ43daZGbBLqcdFpFMSH2su/JuOX9eBWtixifEh5qIls17fD1Xp7UkZ0bbyhwopSuDRFlOR0f+VXURZ4L293d6MbfGa1R5sGvtxsFfMxXWIeaZS2kngvedKiiz+BUZJ6PBrLo5Suivo8Djj5cak5/NJR0e009udVkifmkezlQJyL3XgywslOrHmFdBVT9BmDsI0s2zi1IEWlqZLL8SKpDui1+NgU5vK5jGO60lCf32prdnm1ssJFh9PIQZ8Cs3rIjhetqNVIctMIR5woB9ODAf2o0/DGXYskeg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
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=+v1nQCMlzXy/GQKKLqyAkJK11bMSVju6W9eump/aTHM=;
b=thq7x6Coju59ruMKaZ85FZYefNPqxOhe4H3AvoGFXDpKXq+dbBksRXn2p+DvhAG3I4FaVn1PvA3s7I+kp3A6bGSgT77oOO9blcVFI9Hxanf1vdFzTNPwxj9gjl8FS2AyAZp0X7ZXGZt+jxZTzFCvwE1mWnqO8YOV38eDmNC8P8mmy3bnZVb0nWxIEEZVZuQgpTtCTsjj2UsFHx1rsflpF6Vkpa+plBWKDt+9jXjUvfMyEa41v6WUbT2+3rZGcOnMOzrpl4JdqxyVv62MxEIUy1rsLfG/GwhO64q0AD2D1AMt3TmPxl/kwfP4uQN22cuppN9yjpNZFw/O9jtbc4NmdQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com;
dkim=pass header.d=vivo.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=+v1nQCMlzXy/GQKKLqyAkJK11bMSVju6W9eump/aTHM=;
b=cmZ9KJ323eOfrcQf6yPrJ41aMvnLPm1GtmgaB/Dvvx/yNR1UCAnJqKT1/0t0CtLsLubpuFk+J1Pt2R8Nbf2GOOT4fzVFyvHkUEFBjpmSHNS6HKNF3WHkMeja+mRho2OHONTMueK9JgIOfRtWRkvxDC/Q8eSKL30NB9Ypa7p40RyvpLtwLoqXVvlTGu5v61zU6RXJNnlpxmZUUF2MveOC7zts+5YFnlTTk4TP89DtUEqLoGiOS+xzNSfpbindL3WyLBi6CBKT6exgPuhSI7fos43sEXy7bDK5OrJyQ6FN3ZWCmjCSD66fAObqt+tu448oacMiFTO3244uT3YX+6tEog==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=vivo.com;
Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10)
by SEZPR06MB5829.apcprd06.prod.outlook.com (2603:1096:101:c9::11) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Tue, 20 Aug
2024 09:45:04 +0000
Received: from PUZPR06MB5676.apcprd06.prod.outlook.com
([fe80::a00b:f422:ac44:636f]) by PUZPR06MB5676.apcprd06.prod.outlook.com
([fe80::a00b:f422:ac44:636f%5]) with mapi id 15.20.7875.019; Tue, 20 Aug 2024
09:45:04 +0000
From: Huan Yang
To: "Rafael J. Wysocki" ,
Daniel Lezcano ,
Zhang Rui ,
Lukasz Luba ,
Orson Zhai ,
Baolin Wang ,
Chunyan Zhang ,
linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com,
Huan Yang
Subject: [PATCH] thermal: sprd: Use devm_clk_get_enabled() helpers
Date: Tue, 20 Aug 2024 17:44:49 +0800
Message-ID: <20240820094450.101976-1-link@vivo.com>
X-Mailer: git-send-email 2.45.2
X-ClientProxiedBy: SI1PR02CA0001.apcprd02.prod.outlook.com
(2603:1096:4:1f7::15) To PUZPR06MB5676.apcprd06.prod.outlook.com
(2603:1096:301:f8::10)
Precedence: bulk
X-Mailing-List: linux-pm@vger.kernel.org
List-Id:
List-Subscribe:
List-Unsubscribe:
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|SEZPR06MB5829:EE_
X-MS-Office365-Filtering-Correlation-Id: 2acc8ec3-d649-4ce8-6b1c-08dcc0fcc4e6
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014;
X-Microsoft-Antispam-Message-Info:
VLP5QdpPqvOXnQDJRfTE924U4Bo4p6mubYfhP7ZWP1OVLqaWilyT1d79ARLqHaJjVGV2gg3rSpDmJ54yt3+Op6Vb3sKcs25fe3CiFJOPrd58xUF3dx52zSXYUg/k61mZ7yYTKcBY95FbtQ1eJgivgqtXUS+z/wQhlWUAbK2HzTZGcm0hPOkT1D8SwSxzsp8yAcXl5pUAkrHRdg2l3xbTNouevSYxonxvIdaqIJN1u3AdHbasepU6tnNCkGIbDhisF5jSxlHBkBaS5VJQg06A7Jtp/ZoPvhl16+NIfLJKrYpCuDSo3ncoO4/HMy60md8v95gVQpyG4EOkNgrF8LHZv/FOxv0IA6Z3nT8rT21E+XrCQLgmYZvqrvEZWsDMlCmJ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.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
N1tWsRIVYoWN6HS449xYy53AWMRwm++HqwTK1Wdh03WEZzgyCWfdebnoyySurgSRcJsIQJkDMqmGvABPxySlixASq00mh6b/SkpZl/sBT3AWhf2ocaJ0snj4w3p44LxBXEsVeWfZtwW4wRQRcmWr1wv/XY7lV52+dVZ3TYUdl75eqDpWJjwl3rDfjCmFjk0UcP7AQmIovWYzDYxHbuRt+RrX9+lDs0iWHBXaZr8AE44APX1sH0Z1CDW3cyQTWl8o6x22AZePDu5laT33q5e7EVBiZMdZI8cpewlqOq9MAHQnX8OimQE3IvPsbjAnZqD3tJoa2xXLH+D2RC2SShRWKANLhwZQFfejUNZhKuEN0Y3F3d2iyiavgToW4BxNapdMBt3F1PRUOU8SUem9I9GGI2Lu1RjNVBU05UIIgiiuoFzB4M3pcJpGFbS/q5rIh7seowW2kaNZ/oU+56ptBqAf0SuDHaCcXFKzIRcNiDGduDJow+F7QgCmZTNs1hs7rnYzp6KL+xmAZv5cfBuy3Ad1ArIiiYTlWlj1CdeV2uwOJubtdy24w2aGQ3QYwvKwi2QXLbcTdLSOswKJ2QeflSy5C5j18C6IonhmNs1OGMioc72Mw3o8R4DYRXrSTYj70zQzGlZIHU1YT9nN3pNI/4qfKqCkQbNtGP2sHqScy4rOSt57PGSqZcQyodcgdNKV3sTG6VNH70F96khvqQFqJc1SiecSFVObskK6xsxMit94hlvObFWuieZaOUg7N0rf/qE96gCyFb1FSRCaGe4vFGaLb/SfZGkp+88TpF1iPbXgOnb1qZFGbLPPozlS+MLNSAVQPFfUvtBrmUDbB7rnnfZ0FPZSZq7SM+IWsjDXaIem/LzAHztzf0t530w8Yg4w+WCA38+qHGqKRMwJrAZCD4dj83QFSKdV99UpllbLCGOzla57Tqt8X6y4l7beNPBHE6x+DbwCmy9vghVQ+Prw199SMUxQr6GPHs09DSFsH8KQoiLeIdp+tkcfPbcluA7pHURl2iXPYS0BUXnBBt/i4783JfvnKzHtUoKj1JykG+MOs8bSeZL+AlM3R75daNnUFkkCrmLTiqYVItXI/iWNoE8MDnyT155Si9WyWjB6wL0GLKWHutOxtvd5JhhgMd3JC0Ai9BR4d6G3Y+r32kwYxZETMg8B5+QMtPF7X+SCwtHr6K6QHKPankAKEMZ5HGEflSCbUSSkceif0oOHkwgFfQrOChmMB3uw/OXXT5AbpVcMCODvpLuNhiPAHxyG0UsbKso6mbjku4QJLciEJOqJcdfK3rdrezGZPEeY0iI9gYGb7UCC2wY6vccquLy6InTj3jyz1KKsL4bmQhzIqoqjCcMLd935jsp6t144z2ArKPoJYq5vZjUbjnL0/XYiAMBGuA+CuWChm7iATswHndE0qWbuc+HXIw9F5LiG7xviGcs0YZ4mWCYs3/JyBM5G6cbp3ZMhQQy5jLMDc8f/xaOkgAbDO2cF6tBqJ9dwaFqbPjoLj0gYP1uL2sbGcbIlXJE7sa3WqR1e74lAoMQD2Ck/7T580MNBHwi6V56uT4zj1priMPI8lxo/lvxsritgLh1EJO+d
X-OriginatorOrg: vivo.com
X-MS-Exchange-CrossTenant-Network-Message-Id:
2acc8ec3-d649-4ce8-6b1c-08dcc0fcc4e6
X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2024 09:45:04.8757
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName:
YjNoXFGDqubW94lsKNsTxBPR67xR2xV0t8g88X3I9dsjBxjAcGqn2Q4q/RoPFYStzYzSPAWY13wk+TQutp7/Ag==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5829
The devm_clk_get_enabled() helpers:
- call devm_clk_get()
- call clk_prepare_enable() and register what is needed in order to
call clk_disable_unprepare() when needed, as a managed resource.
This simplifies the code and avoids the calls to clk_disable_unprepare().
Signed-off-by: Huan Yang
Reviewed-by: Baolin Wang
---
drivers/thermal/sprd_thermal.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c
index 874192546548..dfd1d529c410 100644
--- a/drivers/thermal/sprd_thermal.c
+++ b/drivers/thermal/sprd_thermal.c
@@ -359,21 +359,17 @@ static int sprd_thm_probe(struct platform_device *pdev)
return -EINVAL;
}
- thm->clk = devm_clk_get(&pdev->dev, "enable");
+ thm->clk = devm_clk_get_enabled(&pdev->dev, "enable");
if (IS_ERR(thm->clk)) {
dev_err(&pdev->dev, "failed to get enable clock\n");
return PTR_ERR(thm->clk);
}
- ret = clk_prepare_enable(thm->clk);
- if (ret)
- return ret;
-
sprd_thm_para_config(thm);
ret = sprd_thm_cal_read(np, "thm_sign_cal", &val);
if (ret)
- goto disable_clk;
+ return ret;
if (val > 0)
thm->ratio_sign = -1;
@@ -382,7 +378,7 @@ static int sprd_thm_probe(struct platform_device *pdev)
ret = sprd_thm_cal_read(np, "thm_ratio_cal", &thm->ratio_off);
if (ret)
- goto disable_clk;
+ return ret;
for_each_child_of_node(np, sen_child) {
sen = devm_kzalloc(&pdev->dev, sizeof(*sen), GFP_KERNEL);
@@ -439,8 +435,6 @@ static int sprd_thm_probe(struct platform_device *pdev)
of_put:
of_node_put(sen_child);
-disable_clk:
- clk_disable_unprepare(thm->clk);
return ret;
}
@@ -526,8 +520,6 @@ static void sprd_thm_remove(struct platform_device *pdev)
devm_thermal_of_zone_unregister(&pdev->dev,
thm->sensor[i]->tzd);
}
-
- clk_disable_unprepare(thm->clk);
}
static const struct of_device_id sprd_thermal_of_match[] = {