lkml.org 
[lkml]   [2022]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v5 05/30] thermal/core/governors: Use thermal_zone_get_trip() instead of ops functions
On Tue, Sep 27, 2022 at 12:15 AM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> On 26/09/2022 21:34, Rafael J. Wysocki wrote:
> > On Mon, Sep 26, 2022 at 4:06 PM Daniel Lezcano
> > <daniel.lezcano@linaro.org> wrote:
> >>
> >> The governors are using the ops->get_trip_* functions, Replace these
> >> calls with thermal_zone_get_trip().
> >>
> >> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> >> Reviewed-by: Zhang Rui <rui.zhang@intel.com>
> >> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> # 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.

The new message will be different, though.

I think it should be per-tz and the "info" level should be sufficient,
and because thermal_zone_device is based on struct device,
dev_info_once(&tz->dev, ...) should work.

\
 
 \ /
  Last update: 2022-09-27 13:11    [W:0.053 / U:1.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site