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: <20231221124825.149141-23-angelogioacchino.delregno@collabora.com>
Date: Thu, 21 Dec 2023 13:48:21 +0100
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: daniel.lezcano@...aro.org
Cc: rafael@...nel.org,
	rui.zhang@...el.com,
	lukasz.luba@....com,
	linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	kernel@...labora.com
Subject: [RFC PATCH 22/26] cxgb4: Migrate to thermal_zone_device_register()

The thermal API has a new thermal_zone_device_register() function which
is deprecating the older thermal_zone_device_register_with_trips() and
thermal_tripless_zone_device_register().

Migrate to the new thermal zone device registration function.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
---
 .../net/ethernet/chelsio/cxgb4/cxgb4_thermal.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
index dea9d2907666..0192dba14a84 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
@@ -37,12 +37,21 @@ static struct thermal_trip trip = { .type = THERMAL_TRIP_CRITICAL } ;
 
 int cxgb4_thermal_init(struct adapter *adap)
 {
+	struct thermal_zone_device_params tzdp = {
+		.ops = &cxgb4_thermal_ops,
+		.devdata = adap,
+		.trips = &trip,
+		.num_trips = num_trip,
+	};
 	struct ch_thermal *ch_thermal = &adap->ch_thermal;
-	char ch_tz_name[THERMAL_NAME_LENGTH];
 	int num_trip = CXGB4_NUM_TRIPS;
 	u32 param, val;
 	int ret;
 
+	tzdp.type = kasprintf("cxgb4_%s", adap->name);
+	if (!tzdp.type)
+		return -ENOMEM;
+
 	/* on older firmwares we may not get the trip temperature,
 	 * set the num of trips to 0.
 	 */
@@ -58,11 +67,8 @@ int cxgb4_thermal_init(struct adapter *adap)
 		trip.temperature = val * 1000;
 	}
 
-	snprintf(ch_tz_name, sizeof(ch_tz_name), "cxgb4_%s", adap->name);
-	ch_thermal->tzdev = thermal_zone_device_register_with_trips(ch_tz_name, &trip, num_trip,
-								    0, adap,
-								    &cxgb4_thermal_ops,
-								    NULL, 0, 0);
+	ch_thermal->tzdev = thermal_zone_device_register(&tzdp);
+	kfree(tzdp.type);
 	if (IS_ERR(ch_thermal->tzdev)) {
 		ret = PTR_ERR(ch_thermal->tzdev);
 		dev_err(adap->pdev_dev, "Failed to register thermal zone\n");
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ