summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/base/core.c1
-rw-r--r--include/linux/lockdep.h2
-rw-r--r--kernel/lockdep.c5
3 files changed, 8 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 5b91be31cd2d..01193497d7a8 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -550,6 +550,7 @@ void device_initialize(struct device *dev)
kobject_init(&dev->kobj, &device_ktype);
INIT_LIST_HEAD(&dev->dma_pools);
mutex_init(&dev->mutex);
+ lockdep_set_class(&dev->mutex, &__lockdep_no_validate__);
spin_lock_init(&dev->devres_lock);
INIT_LIST_HEAD(&dev->devres_head);
device_init_wakeup(dev, 0);
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index b25d1b53df0d..0eb1ece94d47 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -40,6 +40,8 @@ struct lock_class_key {
struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES];
};
+extern struct lock_class_key __lockdep_no_validate__;
+
#define LOCKSTAT_POINTS 4
/*
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index a53d4fbb721e..76b8fbba675c 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2529,6 +2529,8 @@ void lockdep_init_map(struct lockdep_map *lock, const char *name,
}
EXPORT_SYMBOL_GPL(lockdep_init_map);
+struct lock_class_key __lockdep_no_validate__;
+
/*
* This gets called for every mutex_lock*()/spin_lock*() operation.
* We maintain the dependency maps and validate the locking attempt:
@@ -2561,6 +2563,9 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
return 0;
}
+ if (lock->key == &__lockdep_no_validate__)
+ check = 1;
+
if (!subclass)
class = lock->class_cache;
/*