summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2026-05-13 17:14:33 +0300
committerGuenter Roeck <linux@roeck-us.net>2026-06-09 18:23:00 +0300
commitd1e720c7328e046049b792d03fae093d4d3a72e4 (patch)
tree365eb91ad44b3808841fbcb15b2a99cb5a548ef6 /include/linux
parent563d71205f86dff25c36e3911e3b5faebc9cf35f (diff)
downloadlinux-d1e720c7328e046049b792d03fae093d4d3a72e4.tar.xz
hwmon: Support guard() and scoped_guard for subsystem locks
Add support for guard() and scoped_guard() for the hwmon subsystem lock to simplify its use. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hwmon.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 301a83afbd66..f5330e7ae247 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -13,6 +13,7 @@
#define _HWMON_H_
#include <linux/bitops.h>
+#include <linux/cleanup.h>
struct device;
struct attribute_group;
@@ -495,6 +496,8 @@ char *devm_hwmon_sanitize_name(struct device *dev, const char *name);
void hwmon_lock(struct device *dev);
void hwmon_unlock(struct device *dev);
+DEFINE_GUARD(hwmon_lock, struct device *, hwmon_lock(_T), hwmon_unlock(_T))
+
/**
* hwmon_is_bad_char - Is the char invalid in a hwmon name
* @ch: the char to be considered