diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 18:44:33 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 18:44:33 -0700 |
commit | caf39e87cc1182f7dae84eefc43ca14d54c78ef9 (patch) | |
tree | e8caef545d8c97d839a085dac00f2dd7e2fd95c4 /drivers/base | |
parent | 34bb61f9ddabd7a7f909cbfb05592eb775f6662a (diff) | |
download | linux-caf39e87cc1182f7dae84eefc43ca14d54c78ef9.tar.gz linux-caf39e87cc1182f7dae84eefc43ca14d54c78ef9.tar.bz2 linux-caf39e87cc1182f7dae84eefc43ca14d54c78ef9.zip |
[SCSI] Re-do "final klist fixes"
With the previous commit that introduces the klist enhancements, we can
now re-do 2b7d6a8cb9718fc1d9e826201b64909c44a915f4 again.
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/attribute_container.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c index 6c0f49340eb2..373e7b728fa7 100644 --- a/drivers/base/attribute_container.c +++ b/drivers/base/attribute_container.c @@ -27,6 +27,21 @@ struct internal_container { struct class_device classdev; }; +static void internal_container_klist_get(struct klist_node *n) +{ + struct internal_container *ic = + container_of(n, struct internal_container, node); + class_device_get(&ic->classdev); +} + +static void internal_container_klist_put(struct klist_node *n) +{ + struct internal_container *ic = + container_of(n, struct internal_container, node); + class_device_put(&ic->classdev); +} + + /** * attribute_container_classdev_to_container - given a classdev, return the container * @@ -57,7 +72,8 @@ int attribute_container_register(struct attribute_container *cont) { INIT_LIST_HEAD(&cont->node); - klist_init(&cont->containers); + klist_init(&cont->containers,internal_container_klist_get, + internal_container_klist_put); down(&attribute_container_mutex); list_add_tail(&cont->node, &attribute_container_list); @@ -163,8 +179,8 @@ attribute_container_add_device(struct device *dev, #define klist_for_each_entry(pos, head, member, iter) \ for (klist_iter_init(head, iter); (pos = ({ \ struct klist_node *n = klist_next(iter); \ - n ? ({ klist_iter_exit(iter) ; NULL; }) : \ - container_of(n, typeof(*pos), member);\ + n ? container_of(n, typeof(*pos), member) : \ + ({ klist_iter_exit(iter) ; NULL; }); \ }) ) != NULL; ) @@ -206,7 +222,7 @@ attribute_container_remove_device(struct device *dev, klist_for_each_entry(ic, &cont->containers, node, &iter) { if (dev != ic->classdev.dev) continue; - klist_remove(&ic->node); + klist_del(&ic->node); if (fn) fn(cont, dev, &ic->classdev); else { |