diff options
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index c8a33df00761..6ab73f5c799a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -191,6 +191,20 @@ void device_remove_file(struct device * dev, struct device_attribute * attr) | |||
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | static void klist_children_get(struct klist_node *n) | ||
195 | { | ||
196 | struct device *dev = container_of(n, struct device, knode_parent); | ||
197 | |||
198 | get_device(dev); | ||
199 | } | ||
200 | |||
201 | static void klist_children_put(struct klist_node *n) | ||
202 | { | ||
203 | struct device *dev = container_of(n, struct device, knode_parent); | ||
204 | |||
205 | put_device(dev); | ||
206 | } | ||
207 | |||
194 | 208 | ||
195 | /** | 209 | /** |
196 | * device_initialize - init device structure. | 210 | * device_initialize - init device structure. |
@@ -207,7 +221,8 @@ void device_initialize(struct device *dev) | |||
207 | { | 221 | { |
208 | kobj_set_kset_s(dev, devices_subsys); | 222 | kobj_set_kset_s(dev, devices_subsys); |
209 | kobject_init(&dev->kobj); | 223 | kobject_init(&dev->kobj); |
210 | klist_init(&dev->klist_children); | 224 | klist_init(&dev->klist_children, klist_children_get, |
225 | klist_children_put); | ||
211 | INIT_LIST_HEAD(&dev->dma_pools); | 226 | INIT_LIST_HEAD(&dev->dma_pools); |
212 | init_MUTEX(&dev->sem); | 227 | init_MUTEX(&dev->sem); |
213 | } | 228 | } |