Messages in this thread | | | Date | Tue, 28 Nov 2023 13:15:21 +0000 | Subject | Re: [PATCH v1] thermal: trip: Rework thermal_zone_set_trip() and its callers | From | Lukasz Luba <> |
| |
On 11/28/23 12:57, Rafael J. Wysocki wrote: > On Tue, Nov 28, 2023 at 1:53 PM Rafael J. Wysocki <rafael@kernel.org> wrote: >> >> Hi Lukasz, >> >> On Tue, Nov 28, 2023 at 9:16 AM Lukasz Luba <lukasz.luba@arm.com> wrote: >>> >>> Hi Rafael, >>> >>> On 11/27/23 19:59, Rafael J. Wysocki wrote: >>>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> >>>> > > [cut] > >>>> Index: linux-pm/drivers/thermal/thermal_trip.c >>>> =================================================================== >>>> --- linux-pm.orig/drivers/thermal/thermal_trip.c >>>> +++ linux-pm/drivers/thermal/thermal_trip.c >>>> @@ -148,42 +148,61 @@ int thermal_zone_get_trip(struct thermal >>>> EXPORT_SYMBOL_GPL(thermal_zone_get_trip); >>>> >>>> int thermal_zone_set_trip(struct thermal_zone_device *tz, int trip_id, >>>> - const struct thermal_trip *trip) >>>> + enum thermal_set_trip_target what, const char *buf) >>>> { >>>> - struct thermal_trip t; >>>> - int ret; >>>> + struct thermal_trip *trip; >>>> + int val, ret = 0; >>>> >>>> - if (!tz->ops->set_trip_temp && !tz->ops->set_trip_hyst && !tz->trips) >>>> - return -EINVAL; >>> >>> Here we could bail out when there are no callbacks. >> >> Not really, because the trip is updated regardless. > > Actually, the condition above is always false after recent changes, > because tz->trips[] is always present, so the if () statement is > redundant.
Hmm, yes you're right. This is yet another sign to refactor the old code.
For the rest of your comments in the earlier message - I agree.
When you post the v2 I can give it a try later today.
Regards, Lukasz
| |