summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/locks.c2
-rw-r--r--include/linux/lglock.h8
-rw-r--r--kernel/locking/lglock.c6
3 files changed, 7 insertions, 9 deletions
diff --git a/fs/locks.c b/fs/locks.c
index ee1b15f6fc13..f2cce90df8c8 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2761,7 +2761,7 @@ static int __init filelock_init(void)
filelock_cache = kmem_cache_create("file_lock_cache",
sizeof(struct file_lock), 0, SLAB_PANIC, NULL);
- lg_lock_init(&file_lock_lglock, "file_lock_lglock");
+ lg_lock_init(&file_lock_lglock);
for_each_possible_cpu(i)
INIT_HLIST_HEAD(per_cpu_ptr(&file_lock_list, i));
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
index c92ebd100d9b..d0f59aeca769 100644
--- a/include/linux/lglock.h
+++ b/include/linux/lglock.h
@@ -36,7 +36,6 @@
struct lglock {
arch_spinlock_t __percpu *lock;
#ifdef CONFIG_DEBUG_LOCK_ALLOC
- struct lock_class_key lock_key;
struct lockdep_map lock_dep_map;
#endif
};
@@ -51,7 +50,12 @@ struct lglock {
= __ARCH_SPIN_LOCK_UNLOCKED; \
static struct lglock name = { .lock = &name ## _lock }
-void lg_lock_init(struct lglock *lg, char *name);
+#define lg_lock_init(lock) \
+do { \
+ static struct lock_class_key __key; \
+ \
+ lockdep_init_map(&(lock)->lock_dep_map, #lock, &__key, 0); \
+} while (0)
void lg_local_lock(struct lglock *lg);
void lg_local_unlock(struct lglock *lg);
diff --git a/kernel/locking/lglock.c b/kernel/locking/lglock.c
index 951cfcd10b4a..7c6fd364879b 100644
--- a/kernel/locking/lglock.c
+++ b/kernel/locking/lglock.c
@@ -10,12 +10,6 @@
* Could be added though, just undo lg_lock_init
*/
-void lg_lock_init(struct lglock *lg, char *name)
-{
- LOCKDEP_INIT_MAP(&lg->lock_dep_map, name, &lg->lock_key, 0);
-}
-EXPORT_SYMBOL(lg_lock_init);
-
void lg_local_lock(struct lglock *lg)
{
arch_spinlock_t *lock;