Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3019944pxb; Fri, 5 Nov 2021 08:27:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgby6yLWxY5kD+1JPxZRwDk1JZAfWv7zFhojukzTwkBWGncJa/4iYkz+p972LEO2rfbHP8 X-Received: by 2002:a17:906:f894:: with SMTP id lg20mr19530581ejb.33.1636126073356; Fri, 05 Nov 2021 08:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636126073; cv=none; d=google.com; s=arc-20160816; b=TYdSK+UsUTb9STh2yPC0vKmF6lpqdFAPoYvN9Sia8kWGy1tbehZaPCTJboIuAsxdws 78Gk3Se2VREq4opIKHf44+GHnyWCpAtF5fEByeBUEUZ7nUXPpxtVkV+WFXnPvxmWHl0H t/nAgp0jnafvFvA5PlPOOoPkYDw+CnefSS6akYV0UhEJCLEJwWv0OGHyXlzHwECUC6Qj Zu65BfFKzHpQdSP3Mc8A2Yis9peZNlUBqMwmc1DlNDlfFj9iIiWb/aDqMxWlTnBBEG8Z K08HbUFJdMUwcedNW2VptiuPMsZTlOQ9nGo5/LubJ5j3StBP5m16azZCRKBnqScro2Fg fDOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=bUOR2W6epBW6+U1h+LpOGs060WBlxf7sh7/SU6woHic=; b=JKSd/cx0RsYQoBIbH1hEOs0AIIJ7pt4cyY8ge7XQVNgI4UAzAII9AqhL2MJ/TH+qvs GysR6g5/a7XnE2lz6EovwYEYbpDq+0+/M5lx8LFQy5257aGM6oUmC7RzS+MvmYtSWgwR 3Xb8ioWn81FcSBWUy2oNS/S/SJqKp9xBS6nP4fyTBv1Jt/cwZvjUgjoTgI8mv4JLMpaj lYfwFkxU9v/UWlUtQM83Cxx04hb8RqUEKmfvAsYew9XKYbDXZvE5ebI18UfzWyh8WfDb hl9rLcKOhJvJmxPD2JXcLduDNXAOvPoxSlcaYhUOj7FHJo72bVzeuW95MWaGzQEObHjJ OQNA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si11106014edi.40.2021.11.05.08.27.26; Fri, 05 Nov 2021 08:27: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; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233492AbhKEPZp (ORCPT + 99 others); Fri, 5 Nov 2021 11:25:45 -0400 Received: from mail-ot1-f53.google.com ([209.85.210.53]:41966 "EHLO mail-ot1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233479AbhKEPZn (ORCPT ); Fri, 5 Nov 2021 11:25:43 -0400 Received: by mail-ot1-f53.google.com with SMTP id t21-20020a9d7295000000b0055bf1807972so5423926otj.8; Fri, 05 Nov 2021 08:23:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bUOR2W6epBW6+U1h+LpOGs060WBlxf7sh7/SU6woHic=; b=aQLlMOObhoD6v1Pu77pFMOse/LJT0fXop2AWprBKOdQ+HQd89btyPmdhWFRF/XilWy CY3iSV8d18gkYZVLlQ77kTek7tYM80cwjYilJo52Ma3+G+19mkj6GImMQ65s0INqyc0O hFBIytSiINU1hojnam4p03cYlA5LCti/8Re8rT7M44mr5hoipH2s0qdaPB0xRx1/ra2V LaHVx1kGRXyf5WYsy1q4eFRM81/ncDwVNVsMmHP/4RNZuljZyO/1Z62JZqE0F4XAtbnl 5IM+PLVFthFrmbgmLI87EIzsgf0FSVEVTJ0ODPlDtOtuQQCJIS2r19KDdFQP7xL0UR2g DrJg== X-Gm-Message-State: AOAM532rnA2RP4Xxz0eqfdoZnysmZFGQZJAf7bYMUdrEZSDO9grcPxvN Xo2BhAootBuyMFkXE9jybtlmnj/6Y+VSfpPkPS7t1PlQ X-Received: by 2002:a9d:a64:: with SMTP id 91mr38420884otg.198.1636125783557; Fri, 05 Nov 2021 08:23:03 -0700 (PDT) MIME-Version: 1.0 References: <1635883240-24293-1-git-send-email-manafm@codeaurora.org> In-Reply-To: <1635883240-24293-1-git-send-email-manafm@codeaurora.org> From: "Rafael J. Wysocki" Date: Fri, 5 Nov 2021 16:22:52 +0100 Message-ID: Subject: Re: [PATCH] drivers: thermal: Reset previous low and high trip during thermal zone init To: Manaf Meethalavalappu Pallikunhi , Daniel Lezcano Cc: Zhang Rui , Amit Kucheria , Thara Gopinath , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > + tz->prev_high_trip = INT_MAX; > list_for_each_entry(pos, &tz->thermal_instances, tz_node) > pos->initialized = false; > } > --