diff mbox series

[v5,10/12] thermal/of: Store the trips in the thermal zone

Message ID 20220710123512.1714714-12-daniel.lezcano@linexp.org (mailing list archive)
State New, archived
Delegated to: Daniel Lezcano
Headers show
Series thermal OF rework | expand

Commit Message

Daniel Lezcano July 10, 2022, 12:35 p.m. UTC
As the thermal zone contains the trip point, we can store them
directly when registering the thermal zone. That will allow another
step forward to remove the duplicate thermal zone structure we find in
the thermal_of code.

Cc: Alexandre Bailon <abailon@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
 drivers/thermal/thermal_of.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Rafael J. Wysocki July 19, 2022, 6:24 p.m. UTC | #1
On Sun, Jul 10, 2022 at 2:35 PM Daniel Lezcano
<daniel.lezcano@linexp.org> wrote:
>
> As the thermal zone contains the trip point, we can store them
> directly when registering the thermal zone. That will allow another
> step forward to remove the duplicate thermal zone structure we find in
> the thermal_of code.
>
> Cc: Alexandre Bailon <abailon@baylibre.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
> ---
>  drivers/thermal/thermal_of.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 19243c57b3f4..e187461dd396 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -1119,11 +1119,9 @@ int __init of_parse_thermal_zones(void)
>                 tzp->slope = tz->slope;
>                 tzp->offset = tz->offset;
>
> -               zone = thermal_zone_device_register(child->name, tz->ntrips,
> -                                                   mask, tz,
> -                                                   ops, tzp,
> -                                                   tz->passive_delay,
> -                                                   tz->polling_delay);
> +               zone = thermal_zone_device_register_with_trips(child->name, tz->trips, tz->ntrips,
> +                                                              mask, tz, ops, tzp, tz->passive_delay,
> +                                                              tz->polling_delay);
>                 if (IS_ERR(zone)) {
>                         pr_err("Failed to build %pOFn zone %ld\n", child,
>                                PTR_ERR(zone));
> --

IMO it would be less confusing if this was merged with the patch
introducing thermal_zone_device_register_with_trips().
Daniel Lezcano July 21, 2022, 9:31 p.m. UTC | #2
On 19/07/2022 20:24, Rafael J. Wysocki wrote:
> On Sun, Jul 10, 2022 at 2:35 PM Daniel Lezcano
> <daniel.lezcano@linexp.org> wrote:
>> As the thermal zone contains the trip point, we can store them
>> directly when registering the thermal zone. That will allow another
>> step forward to remove the duplicate thermal zone structure we find in
>> the thermal_of code.
>>
>> Cc: Alexandre Bailon <abailon@baylibre.com>
>> Cc: Kevin Hilman <khilman@baylibre.com>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
>> ---
>>   drivers/thermal/thermal_of.c | 8 +++-----
>>   1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
>> index 19243c57b3f4..e187461dd396 100644
>> --- a/drivers/thermal/thermal_of.c
>> +++ b/drivers/thermal/thermal_of.c
>> @@ -1119,11 +1119,9 @@ int __init of_parse_thermal_zones(void)
>>                  tzp->slope = tz->slope;
>>                  tzp->offset = tz->offset;
>>
>> -               zone = thermal_zone_device_register(child->name, tz->ntrips,
>> -                                                   mask, tz,
>> -                                                   ops, tzp,
>> -                                                   tz->passive_delay,
>> -                                                   tz->polling_delay);
>> +               zone = thermal_zone_device_register_with_trips(child->name, tz->trips, tz->ntrips,
>> +                                                              mask, tz, ops, tzp, tz->passive_delay,
>> +                                                              tz->polling_delay);
>>                  if (IS_ERR(zone)) {
>>                          pr_err("Failed to build %pOFn zone %ld\n", child,
>>                                 PTR_ERR(zone));
>> --
> IMO it would be less confusing if this was merged with the patch
> introducing thermal_zone_device_register_with_trips().

You suggest to merge 8,9 and 10, right ?
Rafael J. Wysocki July 22, 2022, 4:59 p.m. UTC | #3
On Thu, Jul 21, 2022 at 11:31 PM Daniel Lezcano
<daniel.lezcano@linexp.org> wrote:
>
> On 19/07/2022 20:24, Rafael J. Wysocki wrote:
> > On Sun, Jul 10, 2022 at 2:35 PM Daniel Lezcano
> > <daniel.lezcano@linexp.org> wrote:
> >> As the thermal zone contains the trip point, we can store them
> >> directly when registering the thermal zone. That will allow another
> >> step forward to remove the duplicate thermal zone structure we find in
> >> the thermal_of code.
> >>
> >> Cc: Alexandre Bailon <abailon@baylibre.com>
> >> Cc: Kevin Hilman <khilman@baylibre.com>
> >> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
> >> ---
> >>   drivers/thermal/thermal_of.c | 8 +++-----
> >>   1 file changed, 3 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> >> index 19243c57b3f4..e187461dd396 100644
> >> --- a/drivers/thermal/thermal_of.c
> >> +++ b/drivers/thermal/thermal_of.c
> >> @@ -1119,11 +1119,9 @@ int __init of_parse_thermal_zones(void)
> >>                  tzp->slope = tz->slope;
> >>                  tzp->offset = tz->offset;
> >>
> >> -               zone = thermal_zone_device_register(child->name, tz->ntrips,
> >> -                                                   mask, tz,
> >> -                                                   ops, tzp,
> >> -                                                   tz->passive_delay,
> >> -                                                   tz->polling_delay);
> >> +               zone = thermal_zone_device_register_with_trips(child->name, tz->trips, tz->ntrips,
> >> +                                                              mask, tz, ops, tzp, tz->passive_delay,
> >> +                                                              tz->polling_delay);
> >>                  if (IS_ERR(zone)) {
> >>                          pr_err("Failed to build %pOFn zone %ld\n", child,
> >>                                 PTR_ERR(zone));
> >> --
> > IMO it would be less confusing if this was merged with the patch
> > introducing thermal_zone_device_register_with_trips().
>
> You suggest to merge 8,9 and 10, right ?

Yes, if that makes sense.

Generally speaking, I prefer the changes in every patch to be
self-contained, unless the patch would be too large this way or it
would cross boundaries of many subsystems.
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 19243c57b3f4..e187461dd396 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -1119,11 +1119,9 @@  int __init of_parse_thermal_zones(void)
 		tzp->slope = tz->slope;
 		tzp->offset = tz->offset;
 
-		zone = thermal_zone_device_register(child->name, tz->ntrips,
-						    mask, tz,
-						    ops, tzp,
-						    tz->passive_delay,
-						    tz->polling_delay);
+		zone = thermal_zone_device_register_with_trips(child->name, tz->trips, tz->ntrips,
+							       mask, tz, ops, tzp, tz->passive_delay,
+							       tz->polling_delay);
 		if (IS_ERR(zone)) {
 			pr_err("Failed to build %pOFn zone %ld\n", child,
 			       PTR_ERR(zone));