diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2006-10-11 01:45:14 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-10-11 01:45:14 -0400 |
commit | 4dfbb9d8c6cbfc32faa5c71145bd2a43e1f8237c (patch) | |
tree | a4fefea0d5f5930240f4ecd6f9716a029cc927a9 /include/linux | |
parent | 86255d9d0bede79140f4912482447963f00818c0 (diff) |
Lockdep: add lockdep_set_class_and_subclass() and lockdep_set_subclass()
This annotation makes it possible to assign a subclass on lock init. This
annotation is meant to reduce the _nested() annotations by assigning a
default subclass.
One could do without this annotation and rely on lockdep_set_class()
exclusively, but that would require a manual stack of struct lock_class_key
objects.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/lockdep.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 1314ca0f29be..14fec2a23b2e 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -202,7 +202,7 @@ extern int lockdep_internal(void); | |||
202 | */ | 202 | */ |
203 | 203 | ||
204 | extern void lockdep_init_map(struct lockdep_map *lock, const char *name, | 204 | extern void lockdep_init_map(struct lockdep_map *lock, const char *name, |
205 | struct lock_class_key *key); | 205 | struct lock_class_key *key, int subclass); |
206 | 206 | ||
207 | /* | 207 | /* |
208 | * Reinitialize a lock key - for cases where there is special locking or | 208 | * Reinitialize a lock key - for cases where there is special locking or |
@@ -211,9 +211,14 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, | |||
211 | * or they are too narrow (they suffer from a false class-split): | 211 | * or they are too narrow (they suffer from a false class-split): |
212 | */ | 212 | */ |
213 | #define lockdep_set_class(lock, key) \ | 213 | #define lockdep_set_class(lock, key) \ |
214 | lockdep_init_map(&(lock)->dep_map, #key, key) | 214 | lockdep_init_map(&(lock)->dep_map, #key, key, 0) |
215 | #define lockdep_set_class_and_name(lock, key, name) \ | 215 | #define lockdep_set_class_and_name(lock, key, name) \ |
216 | lockdep_init_map(&(lock)->dep_map, name, key) | 216 | lockdep_init_map(&(lock)->dep_map, name, key, 0) |
217 | #define lockdep_set_class_and_subclass(lock, key, sub) \ | ||
218 | lockdep_init_map(&(lock)->dep_map, #key, key, sub) | ||
219 | #define lockdep_set_subclass(lock, sub) \ | ||
220 | lockdep_init_map(&(lock)->dep_map, #lock, \ | ||
221 | (lock)->dep_map.key, sub) | ||
217 | 222 | ||
218 | /* | 223 | /* |
219 | * Acquire a lock. | 224 | * Acquire a lock. |
@@ -257,10 +262,12 @@ static inline int lockdep_internal(void) | |||
257 | # define lock_release(l, n, i) do { } while (0) | 262 | # define lock_release(l, n, i) do { } while (0) |
258 | # define lockdep_init() do { } while (0) | 263 | # define lockdep_init() do { } while (0) |
259 | # define lockdep_info() do { } while (0) | 264 | # define lockdep_info() do { } while (0) |
260 | # define lockdep_init_map(lock, name, key) do { (void)(key); } while (0) | 265 | # define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0) |
261 | # define lockdep_set_class(lock, key) do { (void)(key); } while (0) | 266 | # define lockdep_set_class(lock, key) do { (void)(key); } while (0) |
262 | # define lockdep_set_class_and_name(lock, key, name) \ | 267 | # define lockdep_set_class_and_name(lock, key, name) \ |
263 | do { (void)(key); } while (0) | 268 | do { (void)(key); } while (0) |
269 | #define lockdep_set_class_and_subclass(lock, key, sub) \ | ||
270 | do { (void)(key); } while (0) | ||
264 | # define INIT_LOCKDEP | 271 | # define INIT_LOCKDEP |
265 | # define lockdep_reset() do { debug_locks = 1; } while (0) | 272 | # define lockdep_reset() do { debug_locks = 1; } while (0) |
266 | # define lockdep_free_key_range(start, size) do { } while (0) | 273 | # define lockdep_free_key_range(start, size) do { } while (0) |