diff options
| author | Lee Jones <lee@kernel.org> | 2024-04-12 11:46:50 +0300 |
|---|---|---|
| committer | Lee Jones <lee@kernel.org> | 2024-04-12 11:46:50 +0300 |
| commit | 66f7d2ceae4e49194bfe360e14a848fde420e2fc (patch) | |
| tree | 4d1cc12266a7af17547b27f983472adb969e7f45 /include | |
| parent | ab2ab9e69ef9734b875ce6d43fe3f9f90135daae (diff) | |
| parent | c382e2e3eccb6b7ca8c7aff5092c1668428e7de6 (diff) | |
| download | linux-66f7d2ceae4e49194bfe360e14a848fde420e2fc.tar.xz | |
Merge branches 'ib-leds-mips-sound-6.10' and 'ib-leds-locking-6.10' into ibs-for-leds-merged
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/mutex.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 67edc4ca2bee..a561c629d89f 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -22,6 +22,8 @@ #include <linux/cleanup.h> #include <linux/mutex_types.h> +struct device; + #ifdef CONFIG_DEBUG_LOCK_ALLOC # define __DEP_MAP_MUTEX_INITIALIZER(lockname) \ , .dep_map = { \ @@ -117,6 +119,31 @@ do { \ } while (0) #endif /* CONFIG_PREEMPT_RT */ +#ifdef CONFIG_DEBUG_MUTEXES + +int __devm_mutex_init(struct device *dev, struct mutex *lock); + +#else + +static inline int __devm_mutex_init(struct device *dev, struct mutex *lock) +{ + /* + * When CONFIG_DEBUG_MUTEXES is off mutex_destroy() is just a nop so + * no really need to register it in the devm subsystem. + */ + return 0; +} + +#endif + +#define devm_mutex_init(dev, mutex) \ +({ \ + typeof(mutex) mutex_ = (mutex); \ + \ + mutex_init(mutex_); \ + __devm_mutex_init(dev, mutex_); \ +}) + /* * See kernel/locking/mutex.c for detailed documentation of these APIs. * Also see Documentation/locking/mutex-design.rst. |
