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]
Date: Mon, 17 Jun 2024 20:11:30 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux PM <linux-pm@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
 "Rafael J. Wysocki" <rafael@...nel.org>, Lukasz Luba <lukasz.luba@....com>,
 Daniel Lezcano <daniel.lezcano@...aro.org>,
 Geert Uytterhoeven <geert@...ux-m68k.org>,
 Niklas Söderlund <niklas.soderlund+renesas@...natech.se>
Subject: [PATCH v1 13/14] thermal: trip: Replace thermal_zone_get_num_trips()

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

The only existing caller of thermal_zone_get_num_trips(), which is
rcar_gen3_thermal_probe(), uses this function to check whether or
not the number of trips in the given thermal zone is nonzero.

Because it really only needs to know whether or not the given
thermal zone is tripless, replace thermal_zone_get_num_trips() with
thermal_zone_is_tripless() that can tell rcar_gen3_thermal_probe()
exactly what it needs to know and make it call that function.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
 drivers/thermal/renesas/rcar_gen3_thermal.c |    3 +--
 drivers/thermal/thermal_trip.c              |    6 +++---
 include/linux/thermal.h                     |    2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/thermal/renesas/rcar_gen3_thermal.c
===================================================================
--- linux-pm.orig/drivers/thermal/renesas/rcar_gen3_thermal.c
+++ linux-pm/drivers/thermal/renesas/rcar_gen3_thermal.c
@@ -563,8 +563,7 @@ static int rcar_gen3_thermal_probe(struc
 		if (ret)
 			goto error_unregister;
 
-		ret = thermal_zone_get_num_trips(tsc->zone);
-		if (ret < 0)
+		if (thermal_zone_is_tripless(tsc->zone))
 			goto error_unregister;
 
 		dev_info(dev, "Sensor %u: Loaded %d trip points\n", i, ret);
Index: linux-pm/drivers/thermal/thermal_trip.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_trip.c
+++ linux-pm/drivers/thermal/thermal_trip.c
@@ -55,11 +55,11 @@ int thermal_zone_for_each_trip(struct th
 }
 EXPORT_SYMBOL_GPL(thermal_zone_for_each_trip);
 
-int thermal_zone_get_num_trips(struct thermal_zone_device *tz)
+bool thermal_zone_is_tripless(struct thermal_zone_device *tz)
 {
-	return tz->num_trips;
+	return tz->num_trips == 0;
 }
-EXPORT_SYMBOL_GPL(thermal_zone_get_num_trips);
+EXPORT_SYMBOL_GPL(thermal_zone_is_tripless);
 
 /**
  * thermal_zone_set_trips - Computes the next trip points for the driver
Index: linux-pm/include/linux/thermal.h
===================================================================
--- linux-pm.orig/include/linux/thermal.h
+++ linux-pm/include/linux/thermal.h
@@ -210,7 +210,7 @@ int for_each_thermal_trip(struct thermal
 int thermal_zone_for_each_trip(struct thermal_zone_device *tz,
 			       int (*cb)(struct thermal_trip *, void *),
 			       void *data);
-int thermal_zone_get_num_trips(struct thermal_zone_device *tz);
+bool thermal_zone_is_tripless(struct thermal_zone_device *tz);
 void thermal_zone_set_trip_temp(struct thermal_zone_device *tz,
 				struct thermal_trip *trip, int temp);
 




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ