Re: [PATCH v3 11/12] thermal/of: Use thermal trips stored in the thermal zone

Daniel Lezcano
2022-07-04T21:24:58Z

On 04/07/2022 16:14, Zhang Rui wrote:
> On Sun, 2022-07-03 at 20:30 +0200, Daniel Lezcano wrote:
>> Now that we have the thermal trip stored in the thermal zone in a
>> generic way, we can rely on them and remove one indirection we found
>> in the thermal_of code and do one more step forward the removal of
>> the
>> duplicated structures.
>>
>> Cc: Alexandre Bailon <abailon@baylibre.com>
>> Cc: Kevin Hilman <khilman@baylibre.com>
>> Cc; Eduardo Valentin <eduval@amazon.com>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
>> ---

[ ... ]

>> EXPORT_SYMBOL_GPL(of_thermal_get_ntrips);
>>
>> @@ -139,9 +134,7 @@ EXPORT_SYMBOL_GPL(of_thermal_get_ntrips);
>> */
>> bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, int
>> trip)
>> {
>> - struct __thermal_zone *data = tz->devdata;
>> -
>> - if (!data || trip >= data->ntrips || trip < 0)
>> + if (trip >= tz->ntrips || trip < 0)
>> return false;
>>
>> return true;
>> @@ -161,12 +154,7 @@ EXPORT_SYMBOL_GPL(of_thermal_is_trip_valid);
>> const struct thermal_trip *
>> of_thermal_get_trip_points(struct thermal_zone_device *tz)
>> {
>> - struct __thermal_zone *data = tz->devdata;
>> -
>> - if (!data)
>> - return NULL;
>> -
>> - return data->trips;
>> + return tz->trips;
>> }
>> EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);
>
> what is the difference between
> of_thermal_get_ntrips/of_thermal_get_trip_points and
> thermal_zone_get_ntrips/thermal_zone_get_trips as introduced in this
> patch series?
>
> we need to remove the duplications.

There is no difference between those functions. There are 34 more
patches in the pipe to be sent after this series to do more cleanups and
remove code duplication.