Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp32426410rwd; Fri, 7 Jul 2023 13:51:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlFOtRdo1rRy8qZI6DvkGITar4J6Nc2/tYQkF5CvzKD86eZHXoxVGruEaNjpyiGVnMjTQZWj X-Received: by 2002:a05:6512:239f:b0:4fb:77d6:89c3 with SMTP id c31-20020a056512239f00b004fb77d689c3mr5892302lfv.12.1688763062006; Fri, 07 Jul 2023 13:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688763061; cv=none; d=google.com; s=arc-20160816; b=n8GZ2j766qb/zbW7bSiF5RPcSRceyZujv3BWHFgL1bPvpVJwXTymiWNjvzgxgTaHW3 M1ofzMHq0kkBcGsd3fDdwoPeF4ZzBuPu9+NgNoaJBfXKNokrksqUmWjoA+VR2c5Ku7uX K3mY+z/osWxi/izLKhppr0baFtACwyiToPd3XuaFtHATUbsG0B9yv8sPJ4WFqPEi08ao NJvbU9+zfdoo3pD08usj2+SG6AD6TQS3QD4jCjCE0/uG0r9tChUjdD0/cWa1Yda10+hT AU3AMWyKXFcIoZ6i5JO81VEAEixsChYVstJBde8KUS82cd8bq0ot685RU1SiXyQSXtJY 5vsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=INi3JugwL05IgttziwnbGPvMFEJjhzc+9jyw1opOkqE=; fh=beXPTR4IkbWdl+TGF1x/FajQBVr2qOCSgFmw0AbXfSU=; b=MpNCvoCQwpv+GUIdONAybRq/Dl0FST4FwR080z7zggPnw07L9vAmoCslGsIc6NFO6Z tTKQON6ziVdrArlucdaOsrAa+rPAooOI66g2NblSQ9y2/hTyVSmJPdmmTHfNKTS0AK/Q t/+okda0AZAGq6mUI4NyQAcLWIWq+s3w+7JHf8gkN8zjwvN2FZoU7Zb+t0+y3SGBN+1X BZoi9JhRqYLN/Jh5/SzMaO+ytaH6cdLNC6vJNHgT3yFyPoW4UoRuGgTwI4s7LGuou7ZD iX/9hszI0iuo/jiGyPn68qvdevChb4D1MDqgdm/GetE5UqF7v16zGwg3Qfh4izwAACRZ WaTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ARupnTbk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21-20020aa7cb15000000b0051de00fc4f2si2638790edt.179.2023.07.07.13.50.37; Fri, 07 Jul 2023 13:51:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ARupnTbk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232602AbjGGUiK (ORCPT + 99 others); Fri, 7 Jul 2023 16:38:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232533AbjGGUh5 (ORCPT ); Fri, 7 Jul 2023 16:37:57 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A16891986 for ; Fri, 7 Jul 2023 13:37:56 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fbc59de0e2so25173245e9.3 for ; Fri, 07 Jul 2023 13:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688762275; x=1691354275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=INi3JugwL05IgttziwnbGPvMFEJjhzc+9jyw1opOkqE=; b=ARupnTbks4h3FT95+Y36hjBDayLzdEXaLdFPPyr+ek3g+mJSB/XJYX++SAyGlBMAb/ jMfh1kQ1dMnmOwlxCYORpntRz6a6D/j5C9kxQXyv8STSihhLMggreKVFyIoh8b0QFI6j gOxVQ2XqTMrmwEybx7nUyYG67ccuGB9YL3qp9GVxZSBcGQyGqISD+h7r6O86bztPtrab woGGaQfuANLzpBnzv5Y2yTEZLYbKnJI3JxG1tsAsASUixNLJwFUMrjl9PVkTf0TvbWJe JGmMA3SmmkylQsYK1qwa6i7SVb1C0Ikl5qsXyb0wUHiBtwbOsCsL+yqIYY0wA/FdBj8E EOaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688762275; x=1691354275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=INi3JugwL05IgttziwnbGPvMFEJjhzc+9jyw1opOkqE=; b=eXcy/ZTgtBngMVV+YusdaKoUroaY09QgZzAAXaHWaa4ik19TaShAJueVZzTYrPztjx GznOF66iQS8c/Ie+gl6p2LDWlLd0uxIlpIsrA6ncrRcuiyT5A0oq6+T2LOjCdGwemGyS aeUUOIZjO64ApyZnbdl0Gvcm8B9pGHidjat7kgd+K3UYsfeelFatTYG1/VC0AgpbRA0M fGI2csTo7tAj9EDlNO67vY+BRz3GuP2cyBVybnSG5GBmcPKxDvr2ZaB9SwCaxi/eGhzP jrA80TMPb6rouqzM/F7TRJ5iYZjmEGwL80XCEJhfPgErgFEqfHJDXokvcllH9ZjgqLJn ngLA== X-Gm-Message-State: ABy/qLZy1yE6INNyg2vclAsyNv3pQRRu14XUdP/moeYZjfyyx/xQ9wR7 Oa/X10JVSaQF4IbkzJXAHJWdfoFMbxML8NGVD54= X-Received: by 2002:a05:6000:887:b0:313:f4b9:99cc with SMTP id cs7-20020a056000088700b00313f4b999ccmr5156584wrb.68.1688762275135; Fri, 07 Jul 2023 13:37:55 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id i4-20020adfefc4000000b003143be36d99sm5260674wrp.58.2023.07.07.13.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 13:37:54 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-pm@vger.kernel.org, thierry.reding@gmail.com, linux-kernel@vger.kernel.org, srinivas.pandruvada@linux.intel.com, Amit Kucheria , Zhang Rui , Dhruva Gole , Heiko Stuebner , "Lee, Chun-Yi" , ye xingchen Subject: [PATCH v2 4/4] thermal/drivers/int340x: Do not check the thermal zone state Date: Fri, 7 Jul 2023 22:37:31 +0200 Message-Id: <20230707203731.848188-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707203731.848188-1-daniel.lezcano@linaro.org> References: <20230707203731.848188-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver is accessing the thermal zone state to ensure the state is different from the one we want to set. We don't want the driver to access the thermal zone device internals. Actually, the thermal core code already checks if the thermal zone's state is different before calling this function, thus this check is duplicate. Remove it. Acked-by: srinivas pandruvada Signed-off-by: Daniel Lezcano --- .../intel/int340x_thermal/int3400_thermal.c | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 72a6e28ded2e..c40b03d6c29f 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -503,32 +503,28 @@ static int int3400_thermal_change_mode(struct thermal_zone_device *thermal, { struct int3400_thermal_priv *priv = thermal_zone_device_priv(thermal); int result = 0; + int enabled; if (!priv) return -EINVAL; - if (mode != thermal->mode) { - int enabled; + enabled = mode == THERMAL_DEVICE_ENABLED; - enabled = mode == THERMAL_DEVICE_ENABLED; - - if (priv->os_uuid_mask) { - if (!enabled) { - priv->os_uuid_mask = 0; - result = set_os_uuid_mask(priv, priv->os_uuid_mask); - } - goto eval_odvp; + if (priv->os_uuid_mask) { + if (!enabled) { + priv->os_uuid_mask = 0; + result = set_os_uuid_mask(priv, priv->os_uuid_mask); } - - if (priv->current_uuid_index < 0 || - priv->current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID) - return -EINVAL; - - result = int3400_thermal_run_osc(priv->adev->handle, - int3400_thermal_uuids[priv->current_uuid_index], - &enabled); + goto eval_odvp; } + if (priv->current_uuid_index < 0 || + priv->current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID) + return -EINVAL; + + result = int3400_thermal_run_osc(priv->adev->handle, + int3400_thermal_uuids[priv->current_uuid_index], + &enabled); eval_odvp: evaluate_odvp(priv); -- 2.34.1