Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp345514rwb; Mon, 26 Sep 2022 13:13:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KkTrO4pzH/ZzEq4kKhCvDDlGvqBtr9IcVNBQ6QJvCk4iK0VwTYvV9DiWxt6gQ1IKnLSus X-Received: by 2002:a17:90a:b10c:b0:203:6a73:8a93 with SMTP id z12-20020a17090ab10c00b002036a738a93mr521070pjq.178.1664223239677; Mon, 26 Sep 2022 13:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664223239; cv=none; d=google.com; s=arc-20160816; b=IRmv1ZZVGHiKiwxXShm563TIVVEyJxp5vtQEIdqhSV6GMje0Fr4ArJFDZfykhEtfIN HOG8b57b/yemdmVb7CmeIU88FW5TFW2BH7C+nGJwg8d1k/OvBZVqMsaOktj5+SJPH3Vu ZwxY/Jp2Nr1eRzgC0qGMZCpyhhpuKizSvdxychysRHyh4su9ueywnZMzHSwIHpE1aV/W zaJjE8AMmbo3ZJoPCKoX8SzuXZWINgmj46uRx5d8MTO6Ey125F+oNsTqX5WgM78UcpLq oi6dmZ+WpKwXdzILvPlMtehflIcwak2FyCf9DMxbFdYdwE2JlCTKoNzCgmFU3tvShqZd PoBg== 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=9qHHLR7Gz6nSrU4pdL3MTVlAvxhoAC5Bz+bU1eEpqSc=; b=ADLL1bjF2ZIrmyQDM3A4xJr+76TPfvPCg5CZp/zXq5AgFlOrRnSKMR9W5WlMQxSL4I UBtpril16APZuPxateCmceiPZTN9+UwxW7GSxVYJVwcMnCGSkqy4EwgmnUCml9/FLIZI s9hZErOeeIiVjx0J9A0bPTEa/4im/s5oY8rvhFjA6mltSztSRO/UasuJ7zkdCNHsIc+9 Jy5e5gvJ7MiMl1vcsFO//shWivgDAUVd+iwsiHVYPffec9h12qjAWAUn3mQRGpbpF1Pc ZSOy4V5gPyUkaF8CjIWXAFFamXnKTnbLjclY3EnlCFYzxnLjLZG2Rhs51FIVSPFaanKR hSCA== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd32-20020a056a0027a000b0053f52794b23si21614146pfb.88.2022.09.26.13.13.24; Mon, 26 Sep 2022 13:13:59 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229671AbiIZTe3 (ORCPT + 99 others); Mon, 26 Sep 2022 15:34:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbiIZTe0 (ORCPT ); Mon, 26 Sep 2022 15:34:26 -0400 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62CA09E68C; Mon, 26 Sep 2022 12:34:25 -0700 (PDT) Received: by mail-qk1-f169.google.com with SMTP id y2so4764893qkl.11; Mon, 26 Sep 2022 12:34:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=9qHHLR7Gz6nSrU4pdL3MTVlAvxhoAC5Bz+bU1eEpqSc=; b=ZYjSwqemHUktlT4dvaBvHt+X8ppYCWPEuXkqzhuOmmqH5huSDA+CGaQ0pDpJRFBnr3 NnY9kh1feTZhpXo4vOispjCIwUDep5ijdjDig4l/2Me0PLFYp3EvM6xKSy8HLY2pFVLS tXfNVUBxT+tNj9nT5lRcjFstNCV0BaOVncesaIQSyojjEJb93+4yJE/2o86gXnhVdE2z xo+hS3UBzVtW6HT+w5NRBXTrsDfhhlXW+RRDMQ5q5REgtW5k5H31SRBdA/6pWiSooG1G 8AT8hLbzKgEGpvK5iWPkDVmSgNvrrajmBpL6+GjaCikUZVGTmOyAoezWS7b3QLkYxH91 Fqyw== X-Gm-Message-State: ACrzQf2SquhSkt0EB0/l/T3bt+pdMFwD9nDE2Sp8iM0igYYjBLVN6ZUW PaeNotboDglOWvigCHgwXf/oSZxzIutLGWgrVQc= X-Received: by 2002:a05:620a:4008:b0:6ce:8725:cb7 with SMTP id h8-20020a05620a400800b006ce87250cb7mr15954505qko.480.1664220864578; Mon, 26 Sep 2022 12:34:24 -0700 (PDT) MIME-Version: 1.0 References: <20220926140604.4173723-1-daniel.lezcano@linaro.org> <20220926140604.4173723-6-daniel.lezcano@linaro.org> In-Reply-To: <20220926140604.4173723-6-daniel.lezcano@linaro.org> From: "Rafael J. Wysocki" Date: Mon, 26 Sep 2022 21:34:12 +0200 Message-ID: Subject: Re: [PATCH v5 05/30] thermal/core/governors: Use thermal_zone_get_trip() instead of ops functions To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Linux Kernel Mailing List , Linux PM , "Zhang, Rui" , Lukasz Luba , Amit Kucheria Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Mon, Sep 26, 2022 at 4:06 PM Daniel Lezcano wrote: > > The governors are using the ops->get_trip_* functions, Replace these > calls with thermal_zone_get_trip(). > > Signed-off-by: Daniel Lezcano > Reviewed-by: Zhang Rui > Reviewed-by: Lukasz Luba # IPA > --- > drivers/thermal/gov_bang_bang.c | 29 ++++++++------- > drivers/thermal/gov_fair_share.c | 18 ++++------ > drivers/thermal/gov_power_allocator.c | 51 ++++++++++++--------------- > drivers/thermal/gov_step_wise.c | 22 ++++++------ > 4 files changed, 53 insertions(+), 67 deletions(-) > > diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c > index a08bbe33be96..f5b85e5ea707 100644 > --- a/drivers/thermal/gov_bang_bang.c > +++ b/drivers/thermal/gov_bang_bang.c > @@ -13,26 +13,25 @@ > > #include "thermal_core.h" > > -static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) > +static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id) > { > - int trip_temp, trip_hyst; > + struct thermal_trip trip; > struct thermal_instance *instance; > + int ret; > > - tz->ops->get_trip_temp(tz, trip, &trip_temp); > - > - if (!tz->ops->get_trip_hyst) { > - pr_warn_once("Undefined get_trip_hyst for thermal zone %s - " > - "running with default hysteresis zero\n", tz->type); > - trip_hyst = 0; > - } else > - tz->ops->get_trip_hyst(tz, trip, &trip_hyst); > + ret = __thermal_zone_get_trip(tz, trip_id, &trip); > + if (ret) > + pr_warn_once("Failed to retrieve trip point %d\n", trip_id); Does it even make sense to continue beyond this point if ret is nonzero? All of the contents of trip can be garbage then AFAICS. > + > + if (!trip.hysteresis) > + pr_warn_once("Zero hysteresis value for thermal zone %s\n", tz->type); Why do you want to warn about this? Haven't we declared already that zero hysteresis is valid and normal? > > dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n", > - trip, trip_temp, tz->temperature, > - trip_hyst); > + trip_id, trip.temperature, tz->temperature, > + trip.hysteresis); > > list_for_each_entry(instance, &tz->thermal_instances, tz_node) { > - if (instance->trip != trip) > + if (instance->trip != trip_id) > continue; > > /* in case fan is in initial state, switch the fan off */