From patchwork Tue Aug 29 09:18:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13368732 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA3A8C83F14 for ; Tue, 29 Aug 2023 09:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fBkuiMlWQrUhIB/KEj8lFYeRt3Eu9F/LmdWxYa5BbB0=; b=jx3O1G/OJ/1sEE /T1IXK7WGCo5Ka8xcXXyAI7F0ceuwgB02afn5A2bR+7GiSd5Rw1bTbou974Uh3cakdJRePpPIXbkH +0f43s6ZLk0MVZPeQQagP2l+xR3NgWgeUP193fHh+M0xV1jARlZPoPVxWYsvDIx+s26ioPGQ333TZ hnvyLJASox7R31KrbBMyZY+NiDt2fhuFShx8xVkcqoJEwT2JYpx7SjCq4fdJptv4+5Zr9RZffWsyr Xjyh4qMjSgzI1lHNWPSBm99YYV8TM0sqO85aMhckRFByC+UeARiKlG+nhxpuSThlupoeqcYvlptFH Rga+7gK7Kj1XwWVeUaOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qauxo-00B7md-2b; Tue, 29 Aug 2023 09:24:44 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qauxQ-00B7ft-0n for linux-arm-kernel@lists.infradead.org; Tue, 29 Aug 2023 09:24:21 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092418euoutp0185fadd2b5836ac6a8570f71336fc93fa~-0Fd07cik1654016540euoutp012 for ; Tue, 29 Aug 2023 09:24:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230829092418euoutp0185fadd2b5836ac6a8570f71336fc93fa~-0Fd07cik1654016540euoutp012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301058; bh=uxrdo/kD2daqjjmxIH/c4SF+x6XLXkAixdvHbsmRDwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XFhQ/AeLV5stqfZ7uh7ITLtGukVGSINahJMqLbLxsk9aSeyxj/VfdeC9ViGZs+2av 3nIJOcq6MhPhF36cTbof5XKDQmUnjqN/Yq85mqWo5yrF6JRDfQbuvQA9ubQ0Jy67J0 fOzMnb8O6vJ55dq24sHBV5GDvg28M/B3AhtdjmCI= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230829092418eucas1p1262a7d262936a80e888373a78c47803f~-0FdU-MLX2028420284eucas1p1r; Tue, 29 Aug 2023 09:24:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 88.27.11320.249BDE46; Tue, 29 Aug 2023 10:24:18 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230829092417eucas1p187216bed157d5fb8472780688cf746d2~-0Fc7VcCz2327623276eucas1p11; Tue, 29 Aug 2023 09:24:17 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092417eusmtrp1eb74272d64882257490272d9adab00eb~-0Fc6jzWT3248032480eusmtrp1C; Tue, 29 Aug 2023 09:24:17 +0000 (GMT) X-AuditID: cbfec7f4-97dff70000022c38-1d-64edb942d3a9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 27.E9.10549.149BDE46; Tue, 29 Aug 2023 10:24:17 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092416eusmtip27357c43634c3501df0df9b98f0422dcb~-0Fb-Yloe0986509865eusmtip2f; Tue, 29 Aug 2023 09:24:16 +0000 (GMT) From: Mateusz Majewski To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Mateusz Majewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Bartlomiej Zolnierkiewicz , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH 06/11] thermal: exynos: simplify regulator (de)initialization Date: Tue, 29 Aug 2023 11:18:44 +0200 Message-ID: <20230829091853.626011-7-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230829091853.626011-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDKsWRmVeSWpSXmKPExsWy7djP87pOO9+mGJz7KGTxYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhx fh+TxcR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Xffld4hGxDiFT99cOt/7 gK8SS3FGoqEWc1FxIgBvIzS5UgMAAA== X-CMS-MailID: 20230829092417eucas1p187216bed157d5fb8472780688cf746d2 X-Msg-Generator: CA X-RootMTR: 20230829092417eucas1p187216bed157d5fb8472780688cf746d2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092417eucas1p187216bed157d5fb8472780688cf746d2 References: <20230829091853.626011-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230829_022420_566807_08AF247C X-CRM114-Status: GOOD ( 18.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This does reduce the error granularity a bit, but the code simplification seems to be worth it. Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 33 +++++++--------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 49e9157c3dc7..5c08212ff8ac 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -157,7 +157,6 @@ enum soc_type { * @reference_voltage: reference voltage of amplifier * in the positive-TC generator block * 0 < reference_voltage <= 31 - * @regulator: pointer to the TMU regulator structure. * @reg_conf: pointer to structure to register with core thermal. * @tzd: pointer to thermal_zone_device structure * @ntrip: number of supported trip points. @@ -184,7 +183,6 @@ struct exynos_tmu_data { u16 temp_error1, temp_error2; u8 gain; u8 reference_voltage; - struct regulator *regulator; struct thermal_zone_device *tzd; unsigned int ntrip; bool enabled; @@ -985,42 +983,34 @@ static int exynos_tmu_probe(struct platform_device *pdev) * TODO: Add regulator as an SOC feature, so that regulator enable * is a compulsory call. */ - data->regulator = devm_regulator_get_optional(&pdev->dev, "vtmu"); - if (!IS_ERR(data->regulator)) { - ret = regulator_enable(data->regulator); - if (ret) { - dev_err(&pdev->dev, "failed to enable vtmu\n"); - return ret; - } - } else { - if (PTR_ERR(data->regulator) == -EPROBE_DEFER) + ret = devm_regulator_get_enable_optional(&pdev->dev, "vtmu"); + if (ret) { + if (ret == -EPROBE_DEFER) return -EPROBE_DEFER; - dev_info(&pdev->dev, "Regulator node (vtmu) not found\n"); + dev_info(&pdev->dev, "Failed to get regulator node (vtmu)\n"); } ret = exynos_map_dt_data(pdev); if (ret) - goto err_sensor; + return ret; data->clk = devm_clk_get_enabled(&pdev->dev, "tmu_apbif"); if (IS_ERR(data->clk)) { dev_err(&pdev->dev, "Failed to get clock\n"); - ret = PTR_ERR(data->clk); - goto err_sensor; + return PTR_ERR(data->clk); } data->clk_sec = devm_clk_get(&pdev->dev, "tmu_triminfo_apbif"); if (IS_ERR(data->clk_sec)) { if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) { dev_err(&pdev->dev, "Failed to get triminfo clock\n"); - ret = PTR_ERR(data->clk_sec); - goto err_sensor; + return PTR_ERR(data->clk_sec); } } else { ret = clk_prepare(data->clk_sec); if (ret) { dev_err(&pdev->dev, "Failed to get clock\n"); - goto err_sensor; + return ret; } } @@ -1073,10 +1063,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) err_clk_sec: if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); -err_sensor: - if (!IS_ERR(data->regulator)) - regulator_disable(data->regulator); - return ret; } @@ -1089,9 +1075,6 @@ static int exynos_tmu_remove(struct platform_device *pdev) if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); - if (!IS_ERR(data->regulator)) - regulator_disable(data->regulator); - return 0; }