Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4302209imw; Tue, 12 Jul 2022 05:47:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1urs1XGc0+osB6ZBOxSHLBT+rd81LtvrfyYsUp6V37MW52DxlS0PUruLH2DX9ho+hvPUOvQ X-Received: by 2002:a17:906:5a49:b0:72b:1432:25fc with SMTP id my9-20020a1709065a4900b0072b143225fcmr24119125ejc.405.1657630047343; Tue, 12 Jul 2022 05:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657630047; cv=none; d=google.com; s=arc-20160816; b=ZMqtTFAAhpW3MHDr2H/7yxJ+yuunzgEWgW75oQGAV3HMh9R8P9vStYOIbZLcYBMgpO 2waNtG2LlcS6MGdyhM0QpcK/G8x1msSZ0ZAj9ZSSZtSfuiCRsl4PFIhZ7/v4uk4Fw2+d yCnHNrG3vZUO8xtencHfzVahDFJhr5g/uKLUYwKc1aVjQOCJj6tJLZyyQeUdz1lIGLuQ TjMNx5LZLHvyg4x2fxGrJFpDMkJWuWUVK7hXyjIR+oBPM+ywnPQEm4zGuCoG8ss6DW6W nrhEIL257rs/OlRmOdtvpxKCI0NOSOIfNCDr2ZczkP4degldQWq9sGCBUCOUrOhmDv3d rV9w== 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=xom1RzBZ7FRps6226sKHa07EU34Q84LWtJpL/ehP/zI=; b=A1Y17bJrUVk3XLaodeOpu4ppa6deEhh/cMa6uoWQZLotFszW8+CMy878xaXfPZvA5B z87+fJslchZGab6BidW1x3nk8YkCJSHhh14wrBqyRh+1U8kMcyRB4/AGOPxfOgl9ZFg3 domOzyGWcdua5y1lBKZsTUMyKdHfBsPPMj0p7MvxNEE9vzs5ICy89FmFktw4h9+R6Icd pAmlPNV/XTHgXs60mLUIqfEigWFLRPqoT3gMYl0XLXFuWC3m0fEVDrwL3h2giTuiYSR/ 8wk96VtuF1QgF8GOWOSpTi4VcM4hPadRYy7eFGfECPqDIOy3We0fh8tFoPajrRV9cTDA 5EGQ== 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 g21-20020a056402425500b0043a915fd430si5455627edb.240.2022.07.12.05.47.02; Tue, 12 Jul 2022 05:47:27 -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 S231991AbiGLMkl (ORCPT + 99 others); Tue, 12 Jul 2022 08:40:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbiGLMki (ORCPT ); Tue, 12 Jul 2022 08:40:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CCEE653D11; Tue, 12 Jul 2022 05:40:37 -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 06F481516; Tue, 12 Jul 2022 05:40:38 -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 45F143F70D; Tue, 12 Jul 2022 05:40:36 -0700 (PDT) Message-ID: <5d513646-a917-b969-b2d2-9d5f4e0e6f4d@arm.com> Date: Tue, 12 Jul 2022 13:40:34 +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> From: Lukasz Luba In-Reply-To: <2d680cd9-9e97-e06c-55c2-2a3a1504488e@linaro.org> 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 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 good.