Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3740700rdb; Thu, 14 Sep 2023 00:43:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/FvkCs8uh4P8BlE7REEH9Y9xUdSiHHpe3bZJKNn6tMtgxlrJddg9B0NbiMt2YZC0gvj+h X-Received: by 2002:a05:6870:ec93:b0:1bf:9fa2:bfa3 with SMTP id eo19-20020a056870ec9300b001bf9fa2bfa3mr5156247oab.1.1694677398469; Thu, 14 Sep 2023 00:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694677398; cv=none; d=google.com; s=arc-20160816; b=ERuDL10gj+wNGe7Zan0m95hy7DWctSoUPY8zv8C9mOCetXuSe9iHhWv4/QDDdGv4fq SvgJ5gUp9fMmH+VDit6SCGUweHtYpqywuBuX4rHICUA8Z1diUMFQNHa6ZAMf4al/UFGQ tslfP+g1rSu+HGn76tEy1WSqo7uEMWP+0QfydGbBqfC0OwQKZCjz450akSghiIE8+UwR OqueMCe98QrWxenZG9HZhpMyho0vX80IznX8L9+Unqw4c5a5P7IyBCpRdq0tpTyr7Ebc eukjuWDs55NyX5Ks5HqmXmV8FxkFk4j7LUrgztjATxSjdQvbuN4Uclq5m1Kirzayl79Y hKDQ== 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=Eia8zDzv+HtcosL0sFP1xVfmwcdZSEW7E/46TEr37W0=; fh=2Ixamy1GmAtLCb+w00Kft4GepeKAW+EjUWodYIuhkcs=; b=Q+raLjLhis0U8w5297z0gHVItVbfG9bTHcgimSBZ0vE54MJY0hb0vt6BoCXvalzZUn /4hIBMmV8Tiyju7iu0IJ9t2Sl42lGQ1iJzzj16Lx0DmKTemaTZcJypEhCowZwxfVRTU8 NI9jMzjf+F02q69fo+rsPJX5F/S9sFU+BsfgD/i64FtOT08wbPJSkgOMLkWM180RWOVs SaIqy+WrkAjoJHR8VnuUa4yNslpp+JNmaowMgAWEWcAKu+2okmswmDe4cuGXaS3zLW4i hNhqcYsezzgiYk5Ffz65pZ/rePEYafH9oAxz7JofRrNM0MVQswu1ngbYb8MWYLxuTCJD 55vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aPG7MYup; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y190-20020a638ac7000000b00573f90c0ef5si1010559pgd.126.2023.09.14.00.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 00:43:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aPG7MYup; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id EF87981A43D0; Wed, 13 Sep 2023 01:19:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238517AbjIMITH (ORCPT + 99 others); Wed, 13 Sep 2023 04:19:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232223AbjIMITF (ORCPT ); Wed, 13 Sep 2023 04:19:05 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC15199D for ; Wed, 13 Sep 2023 01:12:01 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-50079d148aeso11166292e87.3 for ; Wed, 13 Sep 2023 01:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694592719; x=1695197519; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Eia8zDzv+HtcosL0sFP1xVfmwcdZSEW7E/46TEr37W0=; b=aPG7MYuphs06h2MiTJoIP3w48iXxygjRv9Wpg3RbzNSW88KW0dDZ/duMIsBR4eDWOY q58R68pCXif+VM1LZCGpgo5Tf8dTUEFLdIKNkc7NSUwQZ8Sy4vPOFPFcjN5Mm9Q89vYH IyaGKkuDz6J65ipA/W016TopVjK8q6XN98QXf8BHnYKn1m5+ZYJEbUuLi/BH45+vIrvj WLyNP+G8kfZe/3MtEkHAbnVM3JpiysEnYjuo9kGdVBto2mzDkOPU2tEfa4w7Z5VRkB+6 ePUHT6OFormAetsQsFd/VMoMEPkMYXsR/xTP0DybdjMdLaCK9avO3wFIsjt5RsYB/7Wy zY4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694592719; x=1695197519; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Eia8zDzv+HtcosL0sFP1xVfmwcdZSEW7E/46TEr37W0=; b=ipNIZ7oesIveGKof71e8K3XdOsS3mC41KEo3isQxOFowQ65KVErXR7Q7MsRVgy3r0g OiBJbrBO7OxDayzFIG6ktNOYFUqnIbn6hWfooaDhqedFsP3whAojWDN3KE554BXrJAxV vIcIV9zfVvJRxAf7YcrIvK3NtYQJTL/DAh6hly1FBhyAvNZ/APDSIVbChZ+yPIVVdki4 IGisUz/LD2IqFUDNLpPbRR42kTDS03shezTSXd6y+UsL+VdQmKlg9TnkVt4F3slO8460 6iq5kr70XUoVhqXNlQ5bjjkhjY99QZitxpktkoKE8AJwc/5QhVrk7xqzq6Q4J0U2Jlam Qi2A== X-Gm-Message-State: AOJu0Yw7/XchI/DYGQ2DhWQWM/SA5agoRcfnpmAvrmlhQCoRisjyUqbZ 5pjtiw8A+fhyZ6nqosCuJNor9A== X-Received: by 2002:a05:6512:551:b0:4fb:8435:3efc with SMTP id h17-20020a056512055100b004fb84353efcmr1283002lfl.16.1694592719163; Wed, 13 Sep 2023 01:11:59 -0700 (PDT) Received: from [192.168.1.20] ([178.197.214.188]) by smtp.gmail.com with ESMTPSA id v1-20020a5d6b01000000b0031f300a4c26sm14741521wrw.93.2023.09.13.01.11.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Sep 2023 01:11:58 -0700 (PDT) Message-ID: Date: Wed, 13 Sep 2023 10:11:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH v2 4/7] thermal: exynos: simplify regulator (de)initialization Content-Language: en-US To: Mateusz Majewski , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Bartlomiej Zolnierkiewicz , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski References: <20230911133435.14061-1-m.majewski2@samsung.com> <20230911133435.14061-5-m.majewski2@samsung.com> From: Krzysztof Kozlowski In-Reply-To: <20230911133435.14061-5-m.majewski2@samsung.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 01:19:06 -0700 (PDT) On 11/09/2023 15:34, Mateusz Majewski wrote: > 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"); This is not equivalent. If regulator is provided and enable fails, the old code is nicely returning error. Now, it will print misleading message - failed to get regulator - and continue. While this simplifies the code, it ignores important running condition - having regulator enabled. Best regards, Krzysztof