linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] thermal: core: Drop redundant trips check from for_each_thermal_trip()
@ 2023-09-19 18:59 Rafael J. Wysocki
  2023-09-26 13:48 ` Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-09-19 18:59 UTC (permalink / raw)
  To: Linux PM; +Cc: LKML, Zhang Rui, Srinivas Pandruvada, Daniel Lezcano

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

It is invalid to call for_each_thermal_trip() on an unregistered thermal
zone anyway, and as per thermal_zone_device_register_with_trips(), the
trips[] table must be present if num_trips is greater than zero for the
given thermal zone.

Hence, the trips check in for_each_thermal_trip() is redundant and so it
can be dropped.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/thermal/thermal_trip.c |    3 ---
 1 file changed, 3 deletions(-)

Index: linux-pm/drivers/thermal/thermal_trip.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_trip.c
+++ linux-pm/drivers/thermal/thermal_trip.c
@@ -17,9 +17,6 @@ int for_each_thermal_trip(struct thermal
 
 	lockdep_assert_held(&tz->lock);
 
-	if (!tz->trips)
-		return -ENODATA;
-
 	for (i = 0; i < tz->num_trips; i++) {
 		ret = cb(&tz->trips[i], data);
 		if (ret)




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] thermal: core: Drop redundant trips check from for_each_thermal_trip()
  2023-09-19 18:59 [PATCH v1] thermal: core: Drop redundant trips check from for_each_thermal_trip() Rafael J. Wysocki
@ 2023-09-26 13:48 ` Daniel Lezcano
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2023-09-26 13:48 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux PM; +Cc: LKML, Zhang Rui, Srinivas Pandruvada

On 19/09/2023 20:59, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> It is invalid to call for_each_thermal_trip() on an unregistered thermal
> zone anyway, and as per thermal_zone_device_register_with_trips(), the
> trips[] table must be present if num_trips is greater than zero for the
> given thermal zone.
> 
> Hence, the trips check in for_each_thermal_trip() is redundant and so it
> can be dropped.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-26 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19 18:59 [PATCH v1] thermal: core: Drop redundant trips check from for_each_thermal_trip() Rafael J. Wysocki
2023-09-26 13:48 ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).