diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-04-26 03:12:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-04-27 13:57:34 -0400 |
commit | 61a2f59af6c8ffd9d6dd53f0da32563d4434e790 (patch) | |
tree | 8e594a846d554c83d27d805d7b233daefbfc545a /drivers/base/attribute_container.c | |
parent | 240936e18b75937e7866934df723c2db0011d24f (diff) |
drivers/base/attribute_container.c: use mutex instead of binary semaphore
use mutex instead of binary semaphore in
drivers/base/attribute_container.c
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/attribute_container.c')
-rw-r--r-- | drivers/base/attribute_container.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c index 22220733f76f..1ec0654665cf 100644 --- a/drivers/base/attribute_container.c +++ b/drivers/base/attribute_container.c | |||
@@ -62,7 +62,7 @@ EXPORT_SYMBOL_GPL(attribute_container_classdev_to_container); | |||
62 | 62 | ||
63 | static struct list_head attribute_container_list; | 63 | static struct list_head attribute_container_list; |
64 | 64 | ||
65 | static DECLARE_MUTEX(attribute_container_mutex); | 65 | static DEFINE_MUTEX(attribute_container_mutex); |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * attribute_container_register - register an attribute container | 68 | * attribute_container_register - register an attribute container |
@@ -77,9 +77,9 @@ attribute_container_register(struct attribute_container *cont) | |||
77 | klist_init(&cont->containers,internal_container_klist_get, | 77 | klist_init(&cont->containers,internal_container_klist_get, |
78 | internal_container_klist_put); | 78 | internal_container_klist_put); |
79 | 79 | ||
80 | down(&attribute_container_mutex); | 80 | mutex_lock(&attribute_container_mutex); |
81 | list_add_tail(&cont->node, &attribute_container_list); | 81 | list_add_tail(&cont->node, &attribute_container_list); |
82 | up(&attribute_container_mutex); | 82 | mutex_unlock(&attribute_container_mutex); |
83 | 83 | ||
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
@@ -94,7 +94,7 @@ int | |||
94 | attribute_container_unregister(struct attribute_container *cont) | 94 | attribute_container_unregister(struct attribute_container *cont) |
95 | { | 95 | { |
96 | int retval = -EBUSY; | 96 | int retval = -EBUSY; |
97 | down(&attribute_container_mutex); | 97 | mutex_lock(&attribute_container_mutex); |
98 | spin_lock(&cont->containers.k_lock); | 98 | spin_lock(&cont->containers.k_lock); |
99 | if (!list_empty(&cont->containers.k_list)) | 99 | if (!list_empty(&cont->containers.k_list)) |
100 | goto out; | 100 | goto out; |
@@ -102,7 +102,7 @@ attribute_container_unregister(struct attribute_container *cont) | |||
102 | list_del(&cont->node); | 102 | list_del(&cont->node); |
103 | out: | 103 | out: |
104 | spin_unlock(&cont->containers.k_lock); | 104 | spin_unlock(&cont->containers.k_lock); |
105 | up(&attribute_container_mutex); | 105 | mutex_unlock(&attribute_container_mutex); |
106 | return retval; | 106 | return retval; |
107 | 107 | ||
108 | } | 108 | } |
@@ -145,7 +145,7 @@ attribute_container_add_device(struct device *dev, | |||
145 | { | 145 | { |
146 | struct attribute_container *cont; | 146 | struct attribute_container *cont; |
147 | 147 | ||
148 | down(&attribute_container_mutex); | 148 | mutex_lock(&attribute_container_mutex); |
149 | list_for_each_entry(cont, &attribute_container_list, node) { | 149 | list_for_each_entry(cont, &attribute_container_list, node) { |
150 | struct internal_container *ic; | 150 | struct internal_container *ic; |
151 | 151 | ||
@@ -173,7 +173,7 @@ attribute_container_add_device(struct device *dev, | |||
173 | attribute_container_add_class_device(&ic->classdev); | 173 | attribute_container_add_class_device(&ic->classdev); |
174 | klist_add_tail(&ic->node, &cont->containers); | 174 | klist_add_tail(&ic->node, &cont->containers); |
175 | } | 175 | } |
176 | up(&attribute_container_mutex); | 176 | mutex_unlock(&attribute_container_mutex); |
177 | } | 177 | } |
178 | 178 | ||
179 | /* FIXME: can't break out of this unless klist_iter_exit is also | 179 | /* FIXME: can't break out of this unless klist_iter_exit is also |
@@ -211,7 +211,7 @@ attribute_container_remove_device(struct device *dev, | |||
211 | { | 211 | { |
212 | struct attribute_container *cont; | 212 | struct attribute_container *cont; |
213 | 213 | ||
214 | down(&attribute_container_mutex); | 214 | mutex_lock(&attribute_container_mutex); |
215 | list_for_each_entry(cont, &attribute_container_list, node) { | 215 | list_for_each_entry(cont, &attribute_container_list, node) { |
216 | struct internal_container *ic; | 216 | struct internal_container *ic; |
217 | struct klist_iter iter; | 217 | struct klist_iter iter; |
@@ -234,7 +234,7 @@ attribute_container_remove_device(struct device *dev, | |||
234 | } | 234 | } |
235 | } | 235 | } |
236 | } | 236 | } |
237 | up(&attribute_container_mutex); | 237 | mutex_unlock(&attribute_container_mutex); |
238 | } | 238 | } |
239 | 239 | ||
240 | /** | 240 | /** |
@@ -255,7 +255,7 @@ attribute_container_device_trigger(struct device *dev, | |||
255 | { | 255 | { |
256 | struct attribute_container *cont; | 256 | struct attribute_container *cont; |
257 | 257 | ||
258 | down(&attribute_container_mutex); | 258 | mutex_lock(&attribute_container_mutex); |
259 | list_for_each_entry(cont, &attribute_container_list, node) { | 259 | list_for_each_entry(cont, &attribute_container_list, node) { |
260 | struct internal_container *ic; | 260 | struct internal_container *ic; |
261 | struct klist_iter iter; | 261 | struct klist_iter iter; |
@@ -273,7 +273,7 @@ attribute_container_device_trigger(struct device *dev, | |||
273 | fn(cont, dev, &ic->classdev); | 273 | fn(cont, dev, &ic->classdev); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | up(&attribute_container_mutex); | 276 | mutex_unlock(&attribute_container_mutex); |
277 | } | 277 | } |
278 | 278 | ||
279 | /** | 279 | /** |
@@ -295,12 +295,12 @@ attribute_container_trigger(struct device *dev, | |||
295 | { | 295 | { |
296 | struct attribute_container *cont; | 296 | struct attribute_container *cont; |
297 | 297 | ||
298 | down(&attribute_container_mutex); | 298 | mutex_lock(&attribute_container_mutex); |
299 | list_for_each_entry(cont, &attribute_container_list, node) { | 299 | list_for_each_entry(cont, &attribute_container_list, node) { |
300 | if (cont->match(cont, dev)) | 300 | if (cont->match(cont, dev)) |
301 | fn(cont, dev); | 301 | fn(cont, dev); |
302 | } | 302 | } |
303 | up(&attribute_container_mutex); | 303 | mutex_unlock(&attribute_container_mutex); |
304 | } | 304 | } |
305 | 305 | ||
306 | /** | 306 | /** |