diff options
author | Laura Garcia <nevola@gmail.com> | 2006-05-23 17:22:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 15:40:49 -0400 |
commit | cad1e55d4d19a49c2b82b74562a6e4e555b05f38 (patch) | |
tree | 8782a20ecc3086277ec9e1f0d97b0e32d058a512 /drivers/base | |
parent | fd869db6eb1ea0ffe251e53a113dbf259400f4f6 (diff) |
[PATCH] firmware_class: s/semaphores/mutexes
Hi, this patch converts semaphores to mutexes for Randy's firmware_class.
Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/firmware_class.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 0c99ae6a3407..5d6c011183f5 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/vmalloc.h> | 15 | #include <linux/vmalloc.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
18 | #include <asm/semaphore.h> | 18 | #include <linux/mutex.h> |
19 | 19 | ||
20 | #include <linux/firmware.h> | 20 | #include <linux/firmware.h> |
21 | #include "base.h" | 21 | #include "base.h" |
@@ -36,7 +36,7 @@ static int loading_timeout = 10; /* In seconds */ | |||
36 | 36 | ||
37 | /* fw_lock could be moved to 'struct firmware_priv' but since it is just | 37 | /* fw_lock could be moved to 'struct firmware_priv' but since it is just |
38 | * guarding for corner cases a global lock should be OK */ | 38 | * guarding for corner cases a global lock should be OK */ |
39 | static DECLARE_MUTEX(fw_lock); | 39 | static DEFINE_MUTEX(fw_lock); |
40 | 40 | ||
41 | struct firmware_priv { | 41 | struct firmware_priv { |
42 | char fw_id[FIRMWARE_NAME_MAX]; | 42 | char fw_id[FIRMWARE_NAME_MAX]; |
@@ -142,9 +142,9 @@ firmware_loading_store(struct class_device *class_dev, | |||
142 | 142 | ||
143 | switch (loading) { | 143 | switch (loading) { |
144 | case 1: | 144 | case 1: |
145 | down(&fw_lock); | 145 | mutex_lock(&fw_lock); |
146 | if (!fw_priv->fw) { | 146 | if (!fw_priv->fw) { |
147 | up(&fw_lock); | 147 | mutex_unlock(&fw_lock); |
148 | break; | 148 | break; |
149 | } | 149 | } |
150 | vfree(fw_priv->fw->data); | 150 | vfree(fw_priv->fw->data); |
@@ -152,7 +152,7 @@ firmware_loading_store(struct class_device *class_dev, | |||
152 | fw_priv->fw->size = 0; | 152 | fw_priv->fw->size = 0; |
153 | fw_priv->alloc_size = 0; | 153 | fw_priv->alloc_size = 0; |
154 | set_bit(FW_STATUS_LOADING, &fw_priv->status); | 154 | set_bit(FW_STATUS_LOADING, &fw_priv->status); |
155 | up(&fw_lock); | 155 | mutex_unlock(&fw_lock); |
156 | break; | 156 | break; |
157 | case 0: | 157 | case 0: |
158 | if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) { | 158 | if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) { |
@@ -185,7 +185,7 @@ firmware_data_read(struct kobject *kobj, | |||
185 | struct firmware *fw; | 185 | struct firmware *fw; |
186 | ssize_t ret_count = count; | 186 | ssize_t ret_count = count; |
187 | 187 | ||
188 | down(&fw_lock); | 188 | mutex_lock(&fw_lock); |
189 | fw = fw_priv->fw; | 189 | fw = fw_priv->fw; |
190 | if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { | 190 | if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { |
191 | ret_count = -ENODEV; | 191 | ret_count = -ENODEV; |
@@ -200,7 +200,7 @@ firmware_data_read(struct kobject *kobj, | |||
200 | 200 | ||
201 | memcpy(buffer, fw->data + offset, ret_count); | 201 | memcpy(buffer, fw->data + offset, ret_count); |
202 | out: | 202 | out: |
203 | up(&fw_lock); | 203 | mutex_unlock(&fw_lock); |
204 | return ret_count; | 204 | return ret_count; |
205 | } | 205 | } |
206 | 206 | ||
@@ -253,7 +253,7 @@ firmware_data_write(struct kobject *kobj, | |||
253 | if (!capable(CAP_SYS_RAWIO)) | 253 | if (!capable(CAP_SYS_RAWIO)) |
254 | return -EPERM; | 254 | return -EPERM; |
255 | 255 | ||
256 | down(&fw_lock); | 256 | mutex_lock(&fw_lock); |
257 | fw = fw_priv->fw; | 257 | fw = fw_priv->fw; |
258 | if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { | 258 | if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { |
259 | retval = -ENODEV; | 259 | retval = -ENODEV; |
@@ -268,7 +268,7 @@ firmware_data_write(struct kobject *kobj, | |||
268 | fw->size = max_t(size_t, offset + count, fw->size); | 268 | fw->size = max_t(size_t, offset + count, fw->size); |
269 | retval = count; | 269 | retval = count; |
270 | out: | 270 | out: |
271 | up(&fw_lock); | 271 | mutex_unlock(&fw_lock); |
272 | return retval; | 272 | return retval; |
273 | } | 273 | } |
274 | 274 | ||
@@ -436,14 +436,14 @@ _request_firmware(const struct firmware **firmware_p, const char *name, | |||
436 | } else | 436 | } else |
437 | wait_for_completion(&fw_priv->completion); | 437 | wait_for_completion(&fw_priv->completion); |
438 | 438 | ||
439 | down(&fw_lock); | 439 | mutex_lock(&fw_lock); |
440 | if (!fw_priv->fw->size || test_bit(FW_STATUS_ABORT, &fw_priv->status)) { | 440 | if (!fw_priv->fw->size || test_bit(FW_STATUS_ABORT, &fw_priv->status)) { |
441 | retval = -ENOENT; | 441 | retval = -ENOENT; |
442 | release_firmware(fw_priv->fw); | 442 | release_firmware(fw_priv->fw); |
443 | *firmware_p = NULL; | 443 | *firmware_p = NULL; |
444 | } | 444 | } |
445 | fw_priv->fw = NULL; | 445 | fw_priv->fw = NULL; |
446 | up(&fw_lock); | 446 | mutex_unlock(&fw_lock); |
447 | class_device_unregister(class_dev); | 447 | class_device_unregister(class_dev); |
448 | goto out; | 448 | goto out; |
449 | 449 | ||