From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77FF9C6FA82 for ; Mon, 26 Sep 2022 22:17:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231435AbiIZWRK (ORCPT ); Mon, 26 Sep 2022 18:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231441AbiIZWQt (ORCPT ); Mon, 26 Sep 2022 18:16:49 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8017C6DFA1 for ; Mon, 26 Sep 2022 15:16:29 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id n10so12238487wrw.12 for ; Mon, 26 Sep 2022 15:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=fu+0FjwhprIPgO5a09eqxMNYO/LQ8KcDzL4zS2a4sK8=; b=Tq/7QkShfKXWHaZSmDsBhK/uJ4YYoO0VCSfWimwhNYm9WkW/g1gGGs2C0RHUu2IJHf UpnWtXOXkJi6jASZKKmu5qjRJ3InB5RPcxCAVBc/4P9LSNmijosQau6xoTtl2Gl50JOp dDryl9aU5WWVM2r/ilKVlD1vMEeN1uPtQ9yBVIajmg8LK3Gcv/OcJjGmD+rXXx7QZQvw 8XTOPCAEm1zzxqEZr9737HLrPJ3sGn+I7TsRCi77LwOY4O+1EY7+gDnOJ654xmlc+4jI QfqXvCwLqfQiaqrT/jS08UZ9aIfi2OqjqtgDW7GDnhwU5mLHz8yWkjgIIP6Q7PwEF9RA MS1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=fu+0FjwhprIPgO5a09eqxMNYO/LQ8KcDzL4zS2a4sK8=; b=EbMHRC1Wy0iSIwAUrq2DSIQrRuPR/vdbwhKlVWtiNh8jC/BIUB4h0ZSGTyWR7Mrp/g OgImJa1kH5LK1Z/AfMyeIa+8zqSqCs5CImTxuLB+XNLCAz7jb5bbUQSXce/AS3L/8PDO wj81UdO+HCFIqkAvjA4N1hl1fNydkDs/6HIq+7dyyXgLp85Ior/cee1AuAR04FnmjVGb Insk5yJQNuP4oiWIU29H4aBIJ6kaUUX/D47zNOLWoj2e5MHN0VmTVas1hHaH5dsGb0yp kdJjvhSLb9yP2p9Da7TP8JCKHnIC4Xy4KrqgEzMWOArXng3rpyB4FmELI6gWTpaowc/3 /9CA== X-Gm-Message-State: ACrzQf1ucphAj5nj06GSZwBjNRyEhmrQPEbHgTRdIxOfOUg/nQozuJKw Tac2YYDjSiioRiIWYXxGd9/URA== X-Google-Smtp-Source: AMsMyM7DvjO1hO1qpGdV7d5GQ2qO7Qur0PM0zGux4SpKnA7GS0Gl/KlMGqoPENBcTdhfL4lv4TRuJw== X-Received: by 2002:adf:ff85:0:b0:228:c365:de29 with SMTP id j5-20020adfff85000000b00228c365de29mr14305477wrr.415.1664230547654; Mon, 26 Sep 2022 15:15:47 -0700 (PDT) Received: from [192.168.10.46] (146725694.box.freepro.com. [130.180.211.218]) by smtp.googlemail.com with ESMTPSA id a10-20020a05600c068a00b003b483000583sm11577253wmn.48.2022.09.26.15.15.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Sep 2022 15:15:47 -0700 (PDT) Message-ID: <657008be-34e3-e2de-a9bd-41d2dc804e51@linaro.org> Date: Tue, 27 Sep 2022 00:15:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v5 05/30] thermal/core/governors: Use thermal_zone_get_trip() instead of ops functions Content-Language: en-US To: "Rafael J. Wysocki" Cc: Linux Kernel Mailing List , Linux PM , "Zhang, Rui" , Lukasz Luba , Amit Kucheria References: <20220926140604.4173723-1-daniel.lezcano@linaro.org> <20220926140604.4173723-6-daniel.lezcano@linaro.org> From: Daniel Lezcano In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/09/2022 21:34, Rafael J. Wysocki wrote: > 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? No, I think we can bail out from here > 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? Apparently the bang-bang governor is expecting a hysteresis value as the check is expecting: >> - 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; It is just to keep a warning as before. >> >> 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 */ -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog