summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-14 16:59:46 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-24 14:48:23 +0200
commita5a98a786e5e31e85a69d30935254e8730734706 (patch)
tree6654682d011b2466324507b7b3fa1ae824ab44d2 /include
parentc597b4e74b124aebf7e3d3f7907e2d4779d870e3 (diff)
downloadlinux-stable-a5a98a786e5e31e85a69d30935254e8730734706.tar.gz
linux-stable-a5a98a786e5e31e85a69d30935254e8730734706.tar.bz2
linux-stable-a5a98a786e5e31e85a69d30935254e8730734706.zip
thermal: core: Add and use cooling device guard
Add and use a special guard for cooling devices. This allows quite a few error code paths to be simplified among other things and brings in code size reduction for a good measure. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/5837621.DvuYhMxLoT@rjwysocki.net Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/thermal.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index bcaa92732e14..754802478b96 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -140,6 +140,9 @@ struct thermal_cooling_device {
#endif
};
+DEFINE_GUARD(cooling_dev, struct thermal_cooling_device *, mutex_lock(&_T->lock),
+ mutex_unlock(&_T->lock))
+
/* Structure to define Thermal Zone parameters */
struct thermal_zone_params {
const char *governor_name;