Re: [PATCH v4 01/30] thermal/core: Add a generic thermal_zone_get_trip() function

From: Zhang Rui
Date: Fri Sep 23 2022 - 09:55:10 EST


> @@ -1142,6 +1138,52 @@ static void thermal_set_delay_jiffies(unsigned
> long *delay_jiffies, int delay_ms
> *delay_jiffies = round_jiffies(*delay_jiffies);
> }
>
> +int thermal_zone_get_num_trips(struct thermal_zone_device *tz)
> +{
> + return tz->num_trips;
> +}
> +EXPORT_SYMBOL_GPL(thermal_zone_get_num_trips);
> +
> +static int __thermal_zone_get_trip(struct thermal_zone_device *tz,
> int trip_id,
> + struct thermal_trip *trip)
> +{
> + int ret;
> +
> + if (!tz || trip_id < 0 || trip_id >= tz->num_trips || !trip)
> + return -EINVAL;
> +
> + if (tz->trips) {
> + *trip = tz->trips[trip_id];
> + return 0;
> + }
> +
> + if (tz->ops->get_trip_hyst) {
> + ret = tz->ops->get_trip_hyst(tz, trip_id, &trip-
> >hysteresis);
> + if (ret)
> + return ret;
> + } else trip->hysteresis = 0;

a separate line?

Other than that,
Reviewed-by: Zhang Rui <rui.zhang@xxxxxxxxx>

thanks,
rui