lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240823154245.1553458-2-daniel.lezcano@linaro.org>
Date: Fri, 23 Aug 2024 17:42:44 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: daniel.lezcano@...aro.org,
	rafael@...nel.org
Cc: linux-pm@...r.kernel.org,
	Jérémie Garcia <jgarcia@...libre.com>,
	Alexandre Bailon <abailon@...libre.com>,
	Zhang Rui <rui.zhang@...el.com>,
	Lukasz Luba <lukasz.luba@....com>,
	linux-kernel@...r.kernel.org (open list)
Subject: [RFC PATCH 2/2] thermal/of: Use thermal_zone_device_param

As we can use the thermal_zone_device_param structure to pass the
thermal zone parameters, let's use it in thermal-of code.

Cc: Jérémie Garcia <jgarcia@...libre.com>
Cc: Alexandre Bailon <abailon@...libre.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
---
 drivers/thermal/thermal_of.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 1f252692815a..3e494ff88648 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -474,12 +474,9 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
 {
 	struct thermal_zone_device_ops of_ops = *ops;
 	struct thermal_zone_device *tz;
-	struct thermal_trip *trips;
-	struct thermal_zone_params tzp = {};
+	struct thermal_zone_params tzp = { .devdata = data, .ops = &of_ops };
 	struct device_node *np;
 	const char *action;
-	int delay, pdelay;
-	int ntrips;
 	int ret;
 
 	np = of_thermal_zone_find(sensor, id);
@@ -489,14 +486,14 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
 		return ERR_CAST(np);
 	}
 
-	trips = thermal_of_trips_init(np, &ntrips);
-	if (IS_ERR(trips)) {
+	tzp.trips = thermal_of_trips_init(np, &tzp.num_trips);
+	if (IS_ERR(tzp.trips)) {
 		pr_err("Failed to find trip points for %pOFn id=%d\n", sensor, id);
 		ret = PTR_ERR(trips);
 		goto out_of_node_put;
 	}
 
-	ret = thermal_of_monitor_init(np, &delay, &pdelay);
+	ret = thermal_of_monitor_init(np, &tzp.polling_delay, &tzp.passive_delay);
 	if (ret) {
 		pr_err("Failed to initialize monitoring delays from %pOFn\n", np);
 		goto out_kfree_trips;
@@ -512,9 +509,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
 		if (!of_ops.critical && !strcasecmp(action, "reboot"))
 			of_ops.critical = thermal_zone_device_critical_reboot;
 
-	tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips,
-						     data, &of_ops, &tzp,
-						     pdelay, delay);
+	tz = thermal_zone_device_register(np->name, &tzp);
 	if (IS_ERR(tz)) {
 		ret = PTR_ERR(tz);
 		pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret);
@@ -522,7 +517,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
 	}
 
 	of_node_put(np);
-	kfree(trips);
+	kfree(tzp.trips);
 
 	ret = thermal_zone_device_enable(tz);
 	if (ret) {
@@ -535,7 +530,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
 	return tz;
 
 out_kfree_trips:
-	kfree(trips);
+	kfree(tzp.trips);
 out_of_node_put:
 	of_node_put(np);
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ