Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1054757rwd; Thu, 25 May 2023 07:30:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ46Lk538N/P6kZWOutBZhSD6jnfvZn1tBzNDM/WVZblF3N9NwP4tq8Jn7IMRx9vUIjDKyRY X-Received: by 2002:a05:6a00:1250:b0:634:7ba3:d142 with SMTP id u16-20020a056a00125000b006347ba3d142mr9013022pfi.10.1685025015834; Thu, 25 May 2023 07:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685025015; cv=none; d=google.com; s=arc-20160816; b=XnmFFHfGTRew0vXs4jB0+gztocIX5f3HKFFwHpPjSjFFFBAtwM6m8/iSvTtN0qPMzP gvriaqLOI5KoGlxQ/5jF32vop5Rg7BCXxM/as+p9okbZA0W/qdqn6QTGNHj/dRi/IC73 FH3NBDV6U1ToifZL4shfouo0Odz7D8py9RNpinzxtiWa/MMlMhxursnK9vaimrrA+gbB 53ZegyY+StoFJJvnGJmZO5sonAEFRlvJTtYAqSvYwS+UIeJLBqPNHSVa1/l+bWZIYt0U Ak6RK8snEGDjbNfzS8nymsDpP4rbujkLXWgdZbSqpU3C8zaC4QTC2LqFk4pwgdhVEXY5 G5Mw== 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=00zbO/h32JbOBK4pj9NMcyYg6KfU8i34rsNlNDxLhwU=; b=hiRmBCfUg7awzPiMDXtxMisj2elzIvPrtcJ2ux3YCYvVTWYuAAOs+KrTFLOVSB7J+i DrfzdZKr/DNE4LpRSaUBnr7/Q+TFcxU/8LpxQpKITxuRfXPZQt3Jw58d8d7KEQQF2BB5 YtJbSGUwqrv4UWYFrl3EPdqlhpOy8RjCyyRBSbcp88a9E6o1UTqODAhs97iZ3ybdGxK/ uL+wm7q+aQpSvv0folytaki0LdJmgwwE6JfvLdjuuTdxdmqwi/ovW33sMjmg1NviZoaj n89jlUiFIY2a8S5kc6xpC2Flcy16viw9X3Ml2Wv3L//IFfDyj6ZW6ypmpbIQHt/A9CZY vrqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WqiKxZE9; 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 h14-20020aa79f4e000000b0064d5b6864d0si1608620pfr.76.2023.05.25.07.30.00; Thu, 25 May 2023 07:30:15 -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=WqiKxZE9; 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 S241520AbjEYOCw (ORCPT + 99 others); Thu, 25 May 2023 10:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241519AbjEYOCn (ORCPT ); Thu, 25 May 2023 10:02:43 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 409A4E6B for ; Thu, 25 May 2023 07:02:14 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3093eb8cd1fso1515333f8f.1 for ; Thu, 25 May 2023 07:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685023328; x=1687615328; 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=00zbO/h32JbOBK4pj9NMcyYg6KfU8i34rsNlNDxLhwU=; b=WqiKxZE9ZACdkHhs/a94AzeA/I0y8YTIHAIfJS41qFT48zEv9pAwMfMC0Y9tq3zc+R zZz7vOUhG2LrYLlq2yoFzOjYRa3OBZA5Sttsdkitc7wmouzZmYA/ZdaVtMgyGrTKHApr +HnIPQDzpREbZRzcCkWhKn1o8x5QQpeNX2/w+VVh1JD702Lj6xl6GQYvBVnrP1w8BLg/ b+ky7KJk7gNHqJV2xEpTBvTN1G1Vclx9W2nYUu2St6/c53Z6KM93zAthmZlGFs6JGdQx QACkydqiSFpCRqeAFzEJsn8YFNp9H6Oq0LXlBSJA6S+BQCBRWfhMns817mFlI2j6dTtr iIHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685023328; x=1687615328; 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=00zbO/h32JbOBK4pj9NMcyYg6KfU8i34rsNlNDxLhwU=; b=Bxo/HA7UKgw3RQ35jI33Z+EOyGI/Q2Rt50gmGlsD17eoSbUaUXc2kKLejp+BIc2RcR OBvMXiMUvSuifmJlJBY4MXnOQBG6U7HkToi/n8kppR6s4EDvvkWkSBEyVCvA9LWdxNYc v0ram72ujRX1DbcBBA7MVWYc2Zp/TMwLctbrSxdyde0tmjbexcVt6ktuZDvVJTqxHFZN 6xkPoQfd4ZkrPAiqYdkXZTbO5Z7x3/4ysHyctNFxJBgpUl5cwr2L2elTlvfWRTfHeXeb iYwmTNIAGU4ehyByvty7yhOWjJ0jh2VQLiJJVdnbgmFsImwbhhJ8rM+ZOwuxsJt2C/K1 CGZA== X-Gm-Message-State: AC+VfDxWx4js984QRSQfVm4NTTfE1KEKG8QvGvxuYpH4AeuG3XasQeEK ZqkEKBWdOahRUgzCXPPOxtX6fQ== X-Received: by 2002:a05:6000:1208:b0:309:3ddc:1c8c with SMTP id e8-20020a056000120800b003093ddc1c8cmr2608310wrx.20.1685023328305; Thu, 25 May 2023 07:02:08 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:5aef:8608:89d7:7961]) by smtp.gmail.com with ESMTPSA id u4-20020adfdd44000000b003063176ef09sm1944866wrm.6.2023.05.25.07.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 07:02:07 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-pm@vger.kernel.org, thierry.reding@gmail.com, Amit Kucheria , Zhang Rui , AngeloGioacchino Del Regno , Baolin Wang , Linus Walleij , ye xingchen , "Lee, Chun-Yi" , Srinivas Pandruvada , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 6/8] thermal/drivers/int340x: Do not check the thermal zone state Date: Thu, 25 May 2023 16:01:33 +0200 Message-Id: <20230525140135.3589917-7-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230525140135.3589917-1-daniel.lezcano@linaro.org> References: <20230525140135.3589917-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=unavailable 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. 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 66e34241b33a..cba636d6784d 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