Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7718
b: refs/heads/master
c: 2b7d6a8
h: refs/heads/master
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Aug 31, 2005
1 parent 7fc7b8e commit 8bb21fc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 53c165e0a6c8a4ff7df316557528fa7a52d20711
refs/heads/master: 2b7d6a8cb9718fc1d9e826201b64909c44a915f4
24 changes: 20 additions & 4 deletions trunk/drivers/base/attribute_container.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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; )


Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8bb21fc

Please sign in to comment.