linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* thermal/drivers/tegra: Getting rid of the get_thermal_instance() usage
@ 2023-01-24 19:57 Daniel Lezcano
  2023-01-26 12:55 ` Thierry Reding
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Lezcano @ 2023-01-24 19:57 UTC (permalink / raw)
  To: Thierry Reding, Wei Ni
  Cc: Rafael J. Wysocki, Jon Hunter, Johan Hovold, Philipp Zabel,
	Linux Kernel Mailing List, linux-tegra@vger.kernel.org,
	Linux PM mailing list


Hi,

does anyone know what is the purpose of the get_thermal_instance() usage 
in this code:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/drivers/thermal/tegra/soctherm.c?h=thermal/linux-next#n623

The driver is using a function which is reserved for the thermal core. 
It should not.

Is the following change ok ?

diff --git a/drivers/thermal/tegra/soctherm.c 
b/drivers/thermal/tegra/soctherm.c
index 220873298d77..5f552402d987 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -620,9 +620,8 @@ static int tegra_thermctl_set_trip_temp(struct 
thermal_zone_device *tz, int trip
  				continue;

  			cdev = ts->throt_cfgs[i].cdev;
-			if (get_thermal_instance(tz, cdev, trip_id))
-				stc = find_throttle_cfg_by_name(ts, cdev->type);
-			else
+			stc = find_throttle_cfg_by_name(ts, cdev->type);
+			if (!stc)
  				continue;

  			return throttrip_program(dev, sg, stc, temp);
@@ -768,9 +767,9 @@ static int tegra_soctherm_set_hwtrips(struct device 
*dev,
  			continue;

  		cdev = ts->throt_cfgs[i].cdev;
-		if (get_thermal_instance(tz, cdev, trip))
-			stc = find_throttle_cfg_by_name(ts, cdev->type);
-		else
+
+		stc = find_throttle_cfg_by_name(ts, cdev->type);
+		if (!stc)
  			continue;

  		ret = throttrip_program(dev, sg, stc, temperature);


-- 
<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 related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-04-11 16:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-24 19:57 thermal/drivers/tegra: Getting rid of the get_thermal_instance() usage Daniel Lezcano
2023-01-26 12:55 ` Thierry Reding
2023-01-26 15:37   ` Daniel Lezcano
2023-02-06 14:50   ` Daniel Lezcano
2023-02-07 12:18     ` Thierry Reding
2023-02-07 12:38       ` Daniel Lezcano
2023-02-07 14:27         ` Thierry Reding
2023-02-10 13:17   ` Daniel Lezcano
2023-02-10 14:09     ` Thierry Reding
2023-02-10 14:36       ` Daniel Lezcano
2023-02-10 15:12         ` Thierry Reding
2023-04-11 10:48           ` Daniel Lezcano
2023-04-11 16:30             ` Thierry Reding
2023-03-08 17:21       ` 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).