Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3164998pxb; Fri, 5 Nov 2021 10:49:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfeMy2E0MyFmMfPi9eB0ZyionMGtd+DHN22B+PMJTeTpN5AEVSpJTx9vxu+WQdKVvq0tVQ X-Received: by 2002:a02:950e:: with SMTP id y14mr10263437jah.88.1636134593142; Fri, 05 Nov 2021 10:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636134593; cv=none; d=google.com; s=arc-20160816; b=d59uYwpVtSJPUatnyvr/31iU2D0sJGb0Ecgoc5I276EuFVLfPjXsSzwJCOUs+TQ0Pi 1HPuk7flvPixDFIf4C2+W3Ao9oDNEe7cDoLGBU1xb1ZOIO9kVzwngHVYsQgLz0dr3cMD HWzeZ/YNaH5cpMEyApaY/KAF0lAUXsfoibkLW8TI2E2W6LS2SoazOzt4Wmn8NrIvkf3C gE5dAO7X2GYafJ1i+3dwfRYKJ5OL0w1vJjIZ8Qh4tkze0pHEgRdyRbL3Y88Z8IGHch6U JoOqIwbceeg9BihTV+e/2W94FwS57aOYeOZGU5It9vw8cWbT8MA4nnUsEN1n3tJ7JN7v Fr7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=qDwmVWSIeX5wK0Zlss+9lopfSxSIFEjjri+vJXI5YY4=; b=ElqOZ9pArV08nXlBZwVS4gYKhU+XKD1Q8pHt8JwLM3QiqYX4DW5bZOWcVQyIIOYZNK aTokU3BSexeiI/ZmNNoEXqsx0/BE4NJcgUtgZUeVmVLJw0FeNwwU/pGOFTTS3tYNDz37 qnyxLO+JlDSWlDVYcRvlaN36PRX8ot2YZJY+qjDT5Ac9ch+EikWb35NSwndTeUrrTixW WnDHBSHKzTOHusKkqzQb8nbA+HVqOGo+Sjky8y0uvIsp8pZY1W0WLP6A1Z34k04tUw0g xwKnPHlRnsEE8o8voUKaWTFNFuORA+wYvmgXTNOTzMo7cqe6rsbKz3yuDpIJ/Q+WqR9S zs+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=jQe4bdVN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si17944931iow.74.2021.11.05.10.49.33; Fri, 05 Nov 2021 10:49:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=jQe4bdVN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231955AbhKERte (ORCPT + 99 others); Fri, 5 Nov 2021 13:49:34 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:15879 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232041AbhKERtd (ORCPT ); Fri, 5 Nov 2021 13:49:33 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1636134413; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=qDwmVWSIeX5wK0Zlss+9lopfSxSIFEjjri+vJXI5YY4=; b=jQe4bdVNZxvUQDAUZmikazYRrmXIsNHmMBHVRQlF9vuoavnD0Tzy8l3DZqW1w5d2ihRwS4YX 421XjcMrce8bWbXvIVq/tdiSGMRWjmrJjFqV9piXyymhx9rEZF1fs8FEcmrPGyNma8BOJqoM 1UKPd2UZ/0y4KxNp3qZU+jnHmd0= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 61856e0be736dec45b7d0515 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 05 Nov 2021 17:46:51 GMT Sender: manafm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3C808C43460; Fri, 5 Nov 2021 17:46:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: manafm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6615DC4338F; Fri, 5 Nov 2021 17:46:49 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 05 Nov 2021 23:16:49 +0530 From: manafm@codeaurora.org To: "Rafael J. Wysocki" Cc: Daniel Lezcano , Zhang Rui , Amit Kucheria , Thara Gopinath , Linux PM , Linux Kernel Mailing List Subject: Re: [PATCH] drivers: thermal: Reset previous low and high trip during thermal zone init In-Reply-To: References: <1635883240-24293-1-git-send-email-manafm@codeaurora.org> Message-ID: X-Sender: manafm@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-11-05 20:52, Rafael J. Wysocki wrote: > On Tue, Nov 2, 2021 at 9:01 PM Manaf Meethalavalappu Pallikunhi > wrote: >> >> During the suspend is in process, thermal_zone_device_update bails out >> thermal zone re-evaluation for any sensor trip violation without >> setting next valid trip to that sensor. It assumes during resume >> it will re-evaluate same thermal zone and update trip. But when it is >> in suspend temperature goes down and on resume path while updating >> thermal zone if temperature is less than previously violated trip, >> thermal zone set trip function evaluates the same previous high and >> previous low trip as new high and low trip. Since there is no change >> in high/low trip, it bails out from thermal zone set trip API without >> setting any trip. It leads to a case where sensor high trip or low >> trip is disabled forever even though thermal zone has a valid high >> or low trip. >> >> During thermal zone device init, reset thermal zone previous high >> and low trip. It resolves above mentioned scenario. > > Makes sense to me. > > Daniel? > >> Signed-off-by: Manaf Meethalavalappu Pallikunhi >> >> --- >> drivers/thermal/thermal_core.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/thermal/thermal_core.c >> b/drivers/thermal/thermal_core.c >> index 21db445..2b7a0b4 100644 >> --- a/drivers/thermal/thermal_core.c >> +++ b/drivers/thermal/thermal_core.c >> @@ -477,6 +477,8 @@ static void thermal_zone_device_init(struct >> thermal_zone_device *tz) >> { >> struct thermal_instance *pos; >> tz->temperature = THERMAL_TEMP_INVALID; >> + tz->prev_low_trip = -INT_MAX; > > Why not use INT_MIN instead? > The thermal_zone_set_trips API uses -INT_MAX as default low trip to start trip aggregation. I used the same default values here as well. >> + tz->prev_high_trip = INT_MAX; >> list_for_each_entry(pos, &tz->thermal_instances, tz_node) >> pos->initialized = false; >> } >> --