From patchwork Mon Sep 11 13:34:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13379353 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 8EAF5EE7FF4 for ; Mon, 11 Sep 2023 13:36:48 +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=PQ0XF34745C83awPd53KSCZhQJV+gW4JtfgKUxRTs2A=; b=cpGOMS76tTWixb oNJ4Mjoh8nqxObbBtJAUXE26nkvfer9dH2yF7qCEXSljmmI02Au1xsYpKCD+X9ydwUZ9QLRCmYdrf CbCtvOHWCQ1FFtJUNViPTs706XNzA5OKZpSvyyAYyzLzLsXxk62h8IL438taFd++vcswospeLH6sO cxz5C+ybYKD083E4bVCdjQ2mt4xvp6Hi/UURJe8WDh0sZrBAQPm+Ecc0ucLbk/QUGOlVWQky58EGn 8rwBeXtXeWJ5mFE8T4nwx+XDVbur3xaMXqFajy4aPUrjfSYeml7zpnwSW3+ABJqEJToaPOeI0zQ2X /9vptFbOZiKSuWgWBziw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5W-000cb2-1M; Mon, 11 Sep 2023 13:36:26 +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 1qfh5P-000cXY-29 for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 13:36:23 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230911133617euoutp01bc86d1466e8f50cb41b6cdad34f7881b~D26LvYxhB2488224882euoutp01M for ; Mon, 11 Sep 2023 13:36:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230911133617euoutp01bc86d1466e8f50cb41b6cdad34f7881b~D26LvYxhB2488224882euoutp01M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1694439377; bh=XK7PxtizlL9SCG8mpzlPzuWhrWWnEfkUq3uRXLUzkvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JhzOz5pi0iGal+9x88x/9a/faJyiiRDNUpkdAoaaE4KZbaSlXbSQ4GEXDLUj9TSBF HES1YrZO5P+uBmabW+AjMOwZIt5IBisORpoTBWgXYRyabWUcIS7ARXPzIEnKOMlF0Y tSsmov2rKJkNNPt4943Szhd4BOv2GojIE15XL3xo= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230911133617eucas1p2852362073e5b3efcfe5a588de775a982~D26LdnZAl1712617126eucas1p2m; Mon, 11 Sep 2023 13:36:17 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 5F.03.37758.1D71FF46; Mon, 11 Sep 2023 14:36:17 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230911133616eucas1p10c5eeb0f0240dde975ccc5935cb5c311~D26LG-1cl1320013200eucas1p1r; Mon, 11 Sep 2023 13:36:16 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230911133616eusmtrp263c0d6531ca98ddf4e69411c98dadc0a~D26LGV6d60864008640eusmtrp2f; Mon, 11 Sep 2023 13:36:16 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-68-64ff17d13616 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A1.8A.14344.0D71FF46; Mon, 11 Sep 2023 14:36:16 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230911133615eusmtip2d8a0d394a91b865243032bb81b27e6ea~D26KEkLPs3194931949eusmtip2U; Mon, 11 Sep 2023 13:36:15 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH v2 4/7] thermal: exynos: simplify regulator (de)initialization Date: Mon, 11 Sep 2023 15:34:28 +0200 Message-ID: <20230911133435.14061-5-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911133435.14061-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHKsWRmVeSWpSXmKPExsWy7djP87oXxf+nGLz6IWTxYN42NovD8yss pj58wmbxfct1Jot5n2Ut9r7eym7x7UoHk8Wmx9dYLS7vmsNm8bn3CKPFjPP7mCwmHpvMbLH2 yF12i7lfpjJbPHnYx+bA77Fz1l12j8V7Xj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b0f0240dde975ccc5935cb5c311 X-Msg-Generator: CA X-RootMTR: 20230911133616eucas1p10c5eeb0f0240dde975ccc5935cb5c311 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230911133616eucas1p10c5eeb0f0240dde975ccc5935cb5c311 References: <20230911133435.14061-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_063620_091801_8B11D575 X-CRM114-Status: GOOD ( 18.97 ) 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 ba9414b419ef..8451deb65f43 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. * @tzd: pointer to thermal_zone_device structure * @ntrip: number of supported trip points. * @enabled: current status of TMU device @@ -183,7 +182,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; @@ -994,42 +992,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(&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; } } @@ -1099,10 +1089,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; } @@ -1117,9 +1103,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; }