diff options
| -rw-r--r-- | drivers/base/attribute_container.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c index 373e7b728fa7..6c0f49340eb2 100644 --- a/drivers/base/attribute_container.c +++ b/drivers/base/attribute_container.c | |||
| @@ -27,21 +27,6 @@ struct internal_container { | |||
| 27 | struct class_device classdev; | 27 | struct class_device classdev; |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | static void internal_container_klist_get(struct klist_node *n) | ||
| 31 | { | ||
| 32 | struct internal_container *ic = | ||
| 33 | container_of(n, struct internal_container, node); | ||
| 34 | class_device_get(&ic->classdev); | ||
| 35 | } | ||
| 36 | |||
| 37 | static void internal_container_klist_put(struct klist_node *n) | ||
| 38 | { | ||
| 39 | struct internal_container *ic = | ||
| 40 | container_of(n, struct internal_container, node); | ||
| 41 | class_device_put(&ic->classdev); | ||
| 42 | } | ||
| 43 | |||
| 44 | |||
| 45 | /** | 30 | /** |
| 46 | * attribute_container_classdev_to_container - given a classdev, return the container | 31 | * attribute_container_classdev_to_container - given a classdev, return the container |
| 47 | * | 32 | * |
| @@ -72,8 +57,7 @@ int | |||
| 72 | attribute_container_register(struct attribute_container *cont) | 57 | attribute_container_register(struct attribute_container *cont) |
| 73 | { | 58 | { |
| 74 | INIT_LIST_HEAD(&cont->node); | 59 | INIT_LIST_HEAD(&cont->node); |
| 75 | klist_init(&cont->containers,internal_container_klist_get, | 60 | klist_init(&cont->containers); |
| 76 | internal_container_klist_put); | ||
| 77 | 61 | ||
| 78 | down(&attribute_container_mutex); | 62 | down(&attribute_container_mutex); |
| 79 | list_add_tail(&cont->node, &attribute_container_list); | 63 | list_add_tail(&cont->node, &attribute_container_list); |
| @@ -179,8 +163,8 @@ attribute_container_add_device(struct device *dev, | |||
| 179 | #define klist_for_each_entry(pos, head, member, iter) \ | 163 | #define klist_for_each_entry(pos, head, member, iter) \ |
| 180 | for (klist_iter_init(head, iter); (pos = ({ \ | 164 | for (klist_iter_init(head, iter); (pos = ({ \ |
| 181 | struct klist_node *n = klist_next(iter); \ | 165 | struct klist_node *n = klist_next(iter); \ |
| 182 | n ? container_of(n, typeof(*pos), member) : \ | 166 | n ? ({ klist_iter_exit(iter) ; NULL; }) : \ |
| 183 | ({ klist_iter_exit(iter) ; NULL; }); \ | 167 | container_of(n, typeof(*pos), member);\ |
| 184 | }) ) != NULL; ) | 168 | }) ) != NULL; ) |
| 185 | 169 | ||
| 186 | 170 | ||
| @@ -222,7 +206,7 @@ attribute_container_remove_device(struct device *dev, | |||
| 222 | klist_for_each_entry(ic, &cont->containers, node, &iter) { | 206 | klist_for_each_entry(ic, &cont->containers, node, &iter) { |
| 223 | if (dev != ic->classdev.dev) | 207 | if (dev != ic->classdev.dev) |
| 224 | continue; | 208 | continue; |
| 225 | klist_del(&ic->node); | 209 | klist_remove(&ic->node); |
| 226 | if (fn) | 210 | if (fn) |
| 227 | fn(cont, dev, &ic->classdev); | 211 | fn(cont, dev, &ic->classdev); |
| 228 | else { | 212 | else { |
