lkml.org 
[lkml]   [2023]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/5] thermal/core: Enforce paired .bind/.unbind callbacks
Date
The .bind/.unbind callbacks are designed to allow the thermal zone
device to bind to/unbind from a matched cooling device, with thermal
instances created/deleted.

In this sense, .bind/.unbind callbacks must exist in pairs.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
drivers/thermal/thermal_core.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 5225d65fb0e0..9c447f22cb39 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1258,6 +1258,11 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
if (num_trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp) && !trips)
return ERR_PTR(-EINVAL);

+ if ((ops->bind && !ops->unbind) || (!ops->bind && ops->unbind)) {
+ pr_err("Thermal zone device .bind/.unbind not paired\n");
+ return ERR_PTR(-EINVAL);
+ }
+
if (!thermal_class)
return ERR_PTR(-ENODEV);

--
2.25.1
\
 
 \ /
  Last update: 2023-03-27 01:16    [W:0.100 / U:0.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site