Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp3008637rdb; Fri, 22 Sep 2023 15:17:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHRfyLTOSmcIcpPhAM4tzyeRRSKfAaIubvfuJh7U9sC+bWE4DaMLOVTVLzY8K6L7wSlhJA X-Received: by 2002:a05:6a21:6d8a:b0:14d:fefd:a2eb with SMTP id wl10-20020a056a216d8a00b0014dfefda2ebmr1027719pzb.22.1695421034097; Fri, 22 Sep 2023 15:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695421034; cv=none; d=google.com; s=arc-20160816; b=zg9L3cuV2I/UtQZ10/ZLp3qI9kmSXdOnQED5XMCn9TTd6L3oANn1eXlutcncxR6m+O vOirhEnAxYxwNgZnK4hAe+1i2KEovAsNybqVeMH25gZi6gw7ZPV4at22ZRThVoq7z6CG H5KqQ8SQLl9ca71oaDDwkPwLF42TD06wFYB+K4cGD/SJbRQ+U3Q9nGjvFiEUpTl56QUv bjhFhCoQydwMtYEoD1TTjPBE2hqRJwS614oAi/CEU1BH43Q8wq2nDdeZot1r+T80iJpk bFsMbczKcRvmv0kTuuSKhsI8Z5E0Z/bl/GbzjuTT0yDx4XEvNOprXi9zbNtHAPeWi22M HH2w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=L7ieYhK78sbHS11kbLtk29UnnHNqbaOJEvM/F6H4PRU=; fh=Jcc1rpXeIsj0ttAxRwxdD0BXxlFdh9vsCVk/kF6A8Vw=; b=yeS2VcyHYfxgT6LWmNVBtW7jLc56kdcR1o9CplokfQkBDzM/jrw7pJ217qb2LM/Pa7 JvZBIHDnqdZUICy89aeLWJv5u2Ij0YsSjSbfJwXaBZUNyF1H7qEGGGqyjrkNVnnpcKtT LbwBhqtIczsPZmsJ2oMixJp7sZGsRnrtBC1XKIol6DE5OEm01/Q16BPeE+nNseUCnyet 8i4Xju8uY9krwgpZLtzFbqicUc2ORaLrM4isiAtTA083kzS0rFO+5r/+efWlY4sjXotW yujExNw5l9w7nOz2v1pU5iM8aAKIp2VmkPELvPArnjMmfvYRmkGGInzSA3kjsXuEwolS LtTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=BPMLsU9t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id eh11-20020a056a00808b00b0068a4dcc9cdesi4577721pfb.7.2023.09.22.15.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 15:17:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=BPMLsU9t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id B1BD980C2E0F; Fri, 22 Sep 2023 12:27:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233867AbjIVT1i (ORCPT + 99 others); Fri, 22 Sep 2023 15:27:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbjIVT1h (ORCPT ); Fri, 22 Sep 2023 15:27:37 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 707CFB9; Fri, 22 Sep 2023 12:27:31 -0700 (PDT) Received: from notapiano.myfiosgateway.com (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madras.collabora.co.uk (Postfix) with ESMTPSA id 7B85266072E7; Fri, 22 Sep 2023 20:27:28 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695410850; bh=8fJ99vinwBbNMB5vLrS3phKoWaPj8xZQRk/04iAxlp4=; h=From:To:Cc:Subject:Date:From; b=BPMLsU9twchJaE3d7Ibqqx6sffOiNGT3NtYP8/dNH/bGOQzjmP2UE8nj1rL2V1tGt uv37haffS2nQb3Wzt/ksDAQ3N9EmRF1RvJkXgBb5Umro+xq+JtPJ//aVwpuN1jBgYT s45Xuc6v0ofSrJRi22dMN2kl9xi2ah7QnPBBmcIMNQ9TPKX3tZNkM8xvQ13osV5VdF v/p5qrjjI0cwjxwJPZBHJyXqY/2ixy6UJmC3GO/RCKNmRWVaurMus5wtYYZf4AqG8g ZRuXUDezBbC+7gvznJnAxFAlqTLsc42huaAJxNWTtwM3o2IAWHA4suHfns1QW9qZRh xQKiRH+ZmBHRg== From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= To: "Rafael J . Wysocki" , Daniel Lezcano Cc: kernel@collabora.com, AngeloGioacchino Del Regno , =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= , Amit Kucheria , Zhang Rui , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH] thermal: core: Check correct temperature for thermal trip notification Date: Fri, 22 Sep 2023 15:27:18 -0400 Message-ID: <20230922192724.295129-1-nfraprado@collabora.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Fri, 22 Sep 2023 12:27:41 -0700 (PDT) X-Spam-Level: ** The thermal trip down notification should be triggered when the temperature goes below the trip temperature minus the hysteresis. But while the temperature is correctly checked against that, the last temperature is instead compared against the trip point temperature. The end result is that the notification won't always be triggered, only when the temperature happens to drop quick enough so that the last temperature was still above the trip point temperature. Fix the incorrect check. Fixes: 55cdf0a283b8 ("thermal: core: Add notifications call in the framework") Signed-off-by: NĂ­colas F. R. A. Prado --- drivers/thermal/thermal_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 58533ea75cd9..120fcf23b8e5 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -361,7 +361,7 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip_id) tz->temperature >= trip.temperature) thermal_notify_tz_trip_up(tz->id, trip_id, tz->temperature); - if (tz->last_temperature >= trip.temperature && + if (tz->last_temperature >= (trip.temperature - trip.hysteresis) && tz->temperature < (trip.temperature - trip.hysteresis)) thermal_notify_tz_trip_down(tz->id, trip_id, tz->temperature); -- 2.42.0