aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/base/base.h2
-rw-r--r--drivers/base/bus.c5
-rw-r--r--include/linux/device/bus.h1
3 files changed, 6 insertions, 2 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 2208af509ce8..0e806f641079 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -52,6 +52,8 @@ struct subsys_private {
struct kset glue_dirs;
struct class *class;
+
+ struct lock_class_key lock_key;
};
#define to_subsys_private(obj) container_of_const(obj, struct subsys_private, subsys.kobj)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index cf1b8f00b4c0..aa70b3a7d778 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -154,6 +154,7 @@ static void bus_release(struct kobject *kobj)
struct subsys_private *priv = to_subsys_private(kobj);
struct bus_type *bus = priv->bus;
+ lockdep_unregister_key(&priv->lock_key);
kfree(priv);
bus->p = NULL;
}
@@ -743,7 +744,7 @@ int bus_register(struct bus_type *bus)
{
int retval;
struct subsys_private *priv;
- struct lock_class_key *key = &bus->lock_key;
+ struct lock_class_key *key;
priv = kzalloc(sizeof(struct subsys_private), GFP_KERNEL);
if (!priv)
@@ -785,6 +786,8 @@ int bus_register(struct bus_type *bus)
}
INIT_LIST_HEAD(&priv->interfaces);
+ key = &priv->lock_key;
+ lockdep_register_key(key);
__mutex_init(&priv->mutex, "subsys mutex", key);
klist_init(&priv->klist_devices, klist_devices_get, klist_devices_put);
klist_init(&priv->klist_drivers, NULL, NULL);
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index 87e4d029c915..e3094db1e9fa 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -112,7 +112,6 @@ struct bus_type {
const struct iommu_ops *iommu_ops;
struct subsys_private *p;
- struct lock_class_key lock_key;
bool need_parent_lock;
};