Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1013878rdf; Wed, 22 Nov 2023 03:24:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBvzT+JWwmedJAsXMj6UWRURt4BCnwoozCUuBlNuQHfIE8MCf1uGGId3uwKpV+xPq2glV8 X-Received: by 2002:a05:6e02:348d:b0:359:4048:38d2 with SMTP id bp13-20020a056e02348d00b00359404838d2mr2296835ilb.0.1700652257860; Wed, 22 Nov 2023 03:24:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700652257; cv=none; d=google.com; s=arc-20160816; b=oDXXzLp2pY798+pNpnqI8eJyizC48rxZMoR4gDfxQkreoM6cCS8xjdDvQwjmECxhbw 5qETmhbJFaLtlgDRDrN1jmJR4CNRvFtgQq4kAelie8hrFkj0XW8Y4gx1+5X/rsGfAYXZ uTSidQrx+PtfPbjTkWJEJrELWFUSoYkdidwJq0bMzC7kXISc95Z521q91XeV0UiDHJ3k brI7PHI0dk63VM1Pc1pCF58SD6L+M0Zam+TA3192ECARNDcfI0fEfMFXZmsX9QyLJTmp aWyrjVuFf/4PdSkCmt4T1tqloejmrbOrMFplDPsEIzJWwLdjjEDMicUP0ngfGlh1b1VC DZmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ZiaBqNqVlXsHFKUILkwVCxKL2dg90m4Llgs5VWsMC84=; fh=RgafyOutMEjmHekZcO6p3NSf4ZJyovtrYWaS7pD3Goo=; b=WnXwnRcvFN1uzqH9UUZ42+96NFjokbMM2CC0WgXJHBeoJuQEvokTcMkuNxYyw7/5Pv 6e7QqBuevV8bRb4yiTuhUVg9kt2DqHsMTTE9/aFRa+yGqpX70ntTN0QVkeBeH1S0VwXN FMyfVPvjjTQlsRRv3Bz2rHg+4R1UyCI4686HqDC1SvUCVIxee44dWTVMKt93hpFnkSFq B+IzLITvmVwzvbWACpMjUV/8ZATEXKWDaEp7Iq4XbllWFYFlIVFQ0P9vztMjMr+HFS/2 5PRJvl81DIyxVcxKQY1/Cw7gcqoH44wUkrdJSf7GmbmaztJFk56xwuEf6YSbX6UeV5W+ Ok7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Ir9ccfWb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id h2-20020a635742000000b005bdbeb537bcsi11737740pgm.37.2023.11.22.03.24.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 03:24:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Ir9ccfWb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id EBEC081AFE46; Wed, 22 Nov 2023 03:24:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343554AbjKVLYF (ORCPT + 99 others); Wed, 22 Nov 2023 06:24:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbjKVLYD (ORCPT ); Wed, 22 Nov 2023 06:24:03 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EEC5D8; Wed, 22 Nov 2023 03:23:59 -0800 (PST) Received: from [100.94.55.57] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madras.collabora.co.uk (Postfix) with ESMTPSA id D77346601A70; Wed, 22 Nov 2023 11:23:56 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1700652238; bh=5TmIolpcIPLP5N8rdAB8FNKOeqZ/zp/Ukqm30CHtAto=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Ir9ccfWbmcCD4s03ppCs67f3x/yk+ABrqSSJQld+Xp89+HAzdOK+q2TQEGfBmXw6k M9oDrpkHtJmxMAAwryZdb2bo6MTkb/GJ1aqgx2K/NxvwPj9jPdrwo9vOWzgPYLAamt ThWOpEZksFuPF61y9l7+p5gBG+qGSQNKZ7Jh5bqHZSnLXUZvWkurbF4Y33Oj1u+XqN aX++W1jsqmYlycvVWkTk21+oc29WPfJ2wdbHgJFnP5F4bfEywPeBwDhXP/V9rxrA2+ dwyHnwUetNoQkG3NFy5kkYUVRiqabi0zQGwu8Y7RhAXWD0VnnJv1Nmyft3rVORTAWj py5Bk9JJNiblw== Message-ID: <6018ec3f-d3e6-4fe0-b57f-9a7994f983a5@collabora.com> Date: Wed, 22 Nov 2023 13:23:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 09/20] soc: mediatek: mtk-svs: Move t-calibration-data retrieval to svs_probe() Content-Language: en-US To: AngeloGioacchino Del Regno , matthias.bgg@gmail.com Cc: krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, robh+dt@kernel.org, p.zabel@pengutronix.de, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com, wenst@chromium.org References: <20231121125044.78642-1-angelogioacchino.delregno@collabora.com> <20231121125044.78642-10-angelogioacchino.delregno@collabora.com> From: Eugen Hristev In-Reply-To: <20231121125044.78642-10-angelogioacchino.delregno@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 03:24:15 -0800 (PST) On 11/21/23 14:50, AngeloGioacchino Del Regno wrote: > The t-calibration-data (SVS-Thermal calibration data) shall exist for > all SoCs or SVS won't work anyway: move it to the common svs_probe() > function and remove it from all of the per-SoC efuse_parsing() probe > callbacks. > > Signed-off-by: AngeloGioacchino Del Regno > --- > drivers/soc/mediatek/mtk-svs.c | 32 ++++++-------------------------- > 1 file changed, 6 insertions(+), 26 deletions(-) > > diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c > index ab564d48092b..1042af2aee3f 100644 > --- a/drivers/soc/mediatek/mtk-svs.c > +++ b/drivers/soc/mediatek/mtk-svs.c > @@ -1884,11 +1884,6 @@ static bool svs_mt8195_efuse_parsing(struct svs_platform *svsp) > svsb->vmax += svsb->dvt_fixed; > } > > - ret = svs_get_efuse_data(svsp, "t-calibration-data", > - &svsp->tefuse, &svsp->tefuse_max); > - if (ret) > - return false; > - Hello Angelo, if you removed the code using `ret` in this patch, it makes sense to also remove the variable here instead of doing it in patch 18. It will avoid unused variable warnings for this patch. > for (i = 0; i < svsp->tefuse_max; i++) > if (svsp->tefuse[i] != 0) > break; > @@ -1949,11 +1944,6 @@ static bool svs_mt8192_efuse_parsing(struct svs_platform *svsp) > svsb->vmax += svsb->dvt_fixed; > } > > - ret = svs_get_efuse_data(svsp, "t-calibration-data", > - &svsp->tefuse, &svsp->tefuse_max); > - if (ret) > - return false; > - > for (i = 0; i < svsp->tefuse_max; i++) > if (svsp->tefuse[i] != 0) > break; > @@ -2009,11 +1999,6 @@ static bool svs_mt8188_efuse_parsing(struct svs_platform *svsp) > svsb->vmax += svsb->dvt_fixed; > } > > - ret = svs_get_efuse_data(svsp, "t-calibration-data", > - &svsp->tefuse, &svsp->tefuse_max); > - if (ret) > - return false; > - > for (i = 0; i < svsp->tefuse_max; i++) > if (svsp->tefuse[i] != 0) > break; > @@ -2097,11 +2082,6 @@ static bool svs_mt8186_efuse_parsing(struct svs_platform *svsp) > svsb->vmax += svsb->dvt_fixed; > } > > - ret = svs_get_efuse_data(svsp, "t-calibration-data", > - &svsp->tefuse, &svsp->tefuse_max); > - if (ret) > - return false; > - > golden_temp = (svsp->tefuse[0] >> 24) & GENMASK(7, 0); > if (!golden_temp) > golden_temp = 50; > @@ -2198,11 +2178,6 @@ static bool svs_mt8183_efuse_parsing(struct svs_platform *svsp) > } > } > > - ret = svs_get_efuse_data(svsp, "t-calibration-data", > - &svsp->tefuse, &svsp->tefuse_max); > - if (ret) > - return false; > - > /* Thermal efuse parsing */ > adc_ge_t = (svsp->tefuse[1] >> 22) & GENMASK(9, 0); > adc_oe_t = (svsp->tefuse[1] >> 12) & GENMASK(9, 0); > @@ -3040,8 +3015,13 @@ static int svs_probe(struct platform_device *pdev) > > ret = svs_get_efuse_data(svsp, "svs-calibration-data", > &svsp->efuse, &svsp->efuse_max); > + if (ret) > + return dev_err_probe(&pdev->dev, ret, "Cannot read SVS calibration\n"); With the previous code, if svs-calibration-data could not be read, the code would go to svs_probe_free_efuse. In your case, it returns directly. I believe that svs_get_efuse_data using nvmem_cell_read does not allocate the buffer for the efuse , hence no more need to free it ? The exit code is checking if it's ERR or NULL, but still, if the buffer was not allocated, it doesn't make sense to jump there indeed. In that case, you are also changing the behavior here , and your commit appears to do more than a simple move. > + > + ret = svs_get_efuse_data(svsp, "t-calibration-data", > + &svsp->tefuse, &svsp->tefuse_max); > if (ret) { > - ret = -EPERM; > + dev_err_probe(&pdev->dev, ret, "Cannot read SVS-Thermal calibration\n"); > goto svs_probe_free_efuse; again in this case the tefuse has not been allocated I assume. So previous code was a bit excessive in trying to free the efuse/tefuse ? Eugen > } >