Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4435593imw; Tue, 12 Jul 2022 07:56:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tXS/tG9M7crHfByj6Yv3GTbWZlJt9kEPGi6Sd1pdLJ9+IupRWy+/o5US45n0k66nemrQ0v X-Received: by 2002:a63:164e:0:b0:411:ce18:5532 with SMTP id 14-20020a63164e000000b00411ce185532mr21730398pgw.55.1657637761944; Tue, 12 Jul 2022 07:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657637761; cv=none; d=google.com; s=arc-20160816; b=JU2gcG3aR/tiso4oA/+hPvB6mYxG60rO8kw8Q2DXySKCTisYTAVKvRlPbQ34yRIwkJ gaNyQGIlhu+8Hs1XCUR59I7WziNGrEoBFtti/DaucvZoStiEyRdA8b++CgQ7iJiaI4b5 YfBzgKYrvxcxD1+bYmmNofV7lcsMCsWZtQKv/ew8OwrIww0blGc8AZZsEZt3/8QAtliM boBgTGKp27uVsgWmvT9Ef1MtWZRV2xs6tg6OQzJheeiF1wTJX1al8+5afG7YuVM8Httw Oq1gXaqusjA4fffVQutX/IDbW+xMt5odODK2AZA8HdXLusOs7DeIjNHgiT7iKcPeZLmx ANCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=5sLFwhCxAcA03FKsVMIrO2HVtZKOZ0ewnkHaF388+bo=; b=uYqCMglxyBWr6S5z/Ae04Fh/foL+pNC24XUWy1lzOiuF8OjDTSkGYYQSxOBfku0BIF 4Cka897lTgd4ks/K6uY7QNNycja4RGAW7eA5I8o6yyLoNqjBDC7P7KCD51SlQEs69v6G bIwIhlOmU4nh5GHPCu5xxLM1HIJOqAmkuHLSFahSayhoBzER2ZWxOUGytVd+8R3iwEXJ av8uSZdaT5jlFWemdL6Co/Rxi1hxSPIXNxEaxTdNwrAn2FyBb4llJAzlHu6s2yGfiBxZ EP9bP8a47Ybiq0Gq5o6eBy22nsAbrEIAQkgTsaILE/p3Ksr6ypTX0YrNjglLrPDHZHCb WhWg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u69-20020a638548000000b004160180db81si7442590pgd.96.2022.07.12.07.55.49; Tue, 12 Jul 2022 07:56:01 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233191AbiGLO2r (ORCPT + 99 others); Tue, 12 Jul 2022 10:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233376AbiGLO2h (ORCPT ); Tue, 12 Jul 2022 10:28:37 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EDCAC2AF3; Tue, 12 Jul 2022 07:28:36 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2E0B51596; Tue, 12 Jul 2022 07:28:37 -0700 (PDT) Received: from [10.57.13.42] (unknown [10.57.13.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7C6E13F73D; Tue, 12 Jul 2022 07:28:35 -0700 (PDT) Message-ID: <4ee2e1fb-89e4-698c-525a-71a4423a245b@arm.com> Date: Tue, 12 Jul 2022 15:28:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2 3/3] thermal/core: Fix thermal trip cross point Content-Language: en-US To: Daniel Lezcano Cc: quic_manafm@quicinc.com, rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , rafael@kernel.org References: <20220708183210.1334839-1-daniel.lezcano@linaro.org> <20220708183210.1334839-3-daniel.lezcano@linaro.org> <6ce87fbb-1460-503b-f1f1-8cf53e702cdf@arm.com> <2d680cd9-9e97-e06c-55c2-2a3a1504488e@linaro.org> <5d513646-a917-b969-b2d2-9d5f4e0e6f4d@arm.com> From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On 7/12/22 14:06, Daniel Lezcano wrote: > On 12/07/2022 14:40, Lukasz Luba wrote: >> >> >> On 7/12/22 13:30, Daniel Lezcano wrote: >>> On 12/07/2022 13:29, Lukasz Luba wrote: >>> >>> [ ... ] >>> >>>>> @@ -511,8 +528,13 @@ void thermal_zone_device_update(struct >>>>> thermal_zone_device *tz, >>>>>       tz->notify_event = event; >>>>> -    for (count = 0; count < tz->trips; count++) >>>>> -        handle_thermal_trip(tz, count); >>>>> +    if (tz->last_temperature <= tz->temperature) { >>>>> +        for (count = 0; count < tz->trips; count++) >>>>> +            handle_thermal_trip(tz, count); >>>>> +    } else { >>>>> +        for (count = tz->prev_trip; count >= 0; count--) >>>>> +            handle_thermal_trip(tz, count); >>>>> +    } >>>> >>>> In general the code look good. I have one question, though: >>>> Is it always true that these trip points coming from the DT >>>> and parsed in thermal_of_build_thermal_zone() populated by >>>>      for_each_child_of_node(child, gchild) { >>>>           thermal_of_populate_trip(gchild, &tz->trips[i++]); >>>> >>>> are always defined in right order in DT? >>> >>> Hmm, that is a good question. Even if the convention is to put the >>> trip point in the ascending order, I don't find any documentation >>> telling it is mandatory. Given that I don't feel particularly >>> comfortable to assume that is the case. >>> >>> Perhaps, it would make more sense to build a map of indexes telling >>> the order in the trip points and work with it instead. >>> >>> >> >> Sounds a reliable way to move forward. Maybe you could just sort in the >> right order those trip points in the thermal_of_build_thermal_zone() >> in an additional patch to this series? >> Than this patch could stay as is, because it looks go > > Unfortunately, there is the manual setup as well as the ACPI. > > > I see. OK, so continue to solve it completely. I can review your next version. Regards, Lukasz