From patchwork Fri Sep 22 19:27:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 143709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5912776vqi; Fri, 22 Sep 2023 15:59:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFpqioDo4HTSJLaYdcmxchp1aTsz9xYcOvJrcldSslqIS3LLFHp8OCxe9lNJdyj12QX8EW X-Received: by 2002:a05:6358:94a0:b0:134:d78f:67bc with SMTP id i32-20020a05635894a000b00134d78f67bcmr804926rwb.14.1695423551256; Fri, 22 Sep 2023 15:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695423551; cv=none; d=google.com; s=arc-20160816; b=d03g4io9a6HRQKauTjn8kgnNkpdH68adCtj3xelzDP1/9QuQu7G5n1hqRH1Dxeq7tH yZm5xK5j3UoDqqo7Jb01whD3VWSgr9Umg2UUDdyePlyVldVk36qtvYAyvkUh3+2lKxGM XF7QFdFb13xEW1UF4lT0aXVBOnxT+tGU3rDt7MfmDvdXsmfAKklSehipokNjBBZnzWmD W5IkS7x61mhMPuLcL1SxGm7M00Q09qPQLXFheb3cCdSw3aJdx4qUPYqB2CLnf8m2CQp1 m9FwSh0K90ifqcpCKAmhrkfGPDSk3iTH6LSjO7HZmCsRxbip7ji/t2/e7XtrbGInklTd Zq2w== 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.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id m62-20020a632641000000b00578c3b0a572si4554984pgm.442.2023.09.22.15.59.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 15:59:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; 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.34 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 howler.vger.email (Postfix) with ESMTP id 122C48535F23; Fri, 22 Sep 2023 12:27:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233868AbjIVT1i (ORCPT + 28 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?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: "Rafael J . Wysocki" , Daniel Lezcano Cc: kernel@collabora.com, AngeloGioacchino Del Regno , =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 12:27:37 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777780445404014678 X-GMAIL-MSGID: 1777780445404014678 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 Reviewed-by: AngeloGioacchino Del Regno --- 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);