Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28295
b: refs/heads/master
c: cad1e55
h: refs/heads/master
i:
  28293: d4361f8
  28291: 6596a2d
  28287: 1105efa
v: v3
  • Loading branch information
Laura Garcia authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent 1a17837 commit 514cbe9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 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: fd869db6eb1ea0ffe251e53a113dbf259400f4f6
refs/heads/master: cad1e55d4d19a49c2b82b74562a6e4e555b05f38
22 changes: 11 additions & 11 deletions trunk/drivers/base/firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>

#include <linux/firmware.h>
#include "base.h"
Expand All @@ -36,7 +36,7 @@ static int loading_timeout = 10; /* In seconds */

/* fw_lock could be moved to 'struct firmware_priv' but since it is just
* guarding for corner cases a global lock should be OK */
static DECLARE_MUTEX(fw_lock);
static DEFINE_MUTEX(fw_lock);

struct firmware_priv {
char fw_id[FIRMWARE_NAME_MAX];
Expand Down Expand Up @@ -142,17 +142,17 @@ firmware_loading_store(struct class_device *class_dev,

switch (loading) {
case 1:
down(&fw_lock);
mutex_lock(&fw_lock);
if (!fw_priv->fw) {
up(&fw_lock);
mutex_unlock(&fw_lock);
break;
}
vfree(fw_priv->fw->data);
fw_priv->fw->data = NULL;
fw_priv->fw->size = 0;
fw_priv->alloc_size = 0;
set_bit(FW_STATUS_LOADING, &fw_priv->status);
up(&fw_lock);
mutex_unlock(&fw_lock);
break;
case 0:
if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) {
Expand Down Expand Up @@ -185,7 +185,7 @@ firmware_data_read(struct kobject *kobj,
struct firmware *fw;
ssize_t ret_count = count;

down(&fw_lock);
mutex_lock(&fw_lock);
fw = fw_priv->fw;
if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) {
ret_count = -ENODEV;
Expand All @@ -200,7 +200,7 @@ firmware_data_read(struct kobject *kobj,

memcpy(buffer, fw->data + offset, ret_count);
out:
up(&fw_lock);
mutex_unlock(&fw_lock);
return ret_count;
}

Expand Down Expand Up @@ -253,7 +253,7 @@ firmware_data_write(struct kobject *kobj,
if (!capable(CAP_SYS_RAWIO))
return -EPERM;

down(&fw_lock);
mutex_lock(&fw_lock);
fw = fw_priv->fw;
if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) {
retval = -ENODEV;
Expand All @@ -268,7 +268,7 @@ firmware_data_write(struct kobject *kobj,
fw->size = max_t(size_t, offset + count, fw->size);
retval = count;
out:
up(&fw_lock);
mutex_unlock(&fw_lock);
return retval;
}

Expand Down Expand Up @@ -436,14 +436,14 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
} else
wait_for_completion(&fw_priv->completion);

down(&fw_lock);
mutex_lock(&fw_lock);
if (!fw_priv->fw->size || test_bit(FW_STATUS_ABORT, &fw_priv->status)) {
retval = -ENOENT;
release_firmware(fw_priv->fw);
*firmware_p = NULL;
}
fw_priv->fw = NULL;
up(&fw_lock);
mutex_unlock(&fw_lock);
class_device_unregister(class_dev);
goto out;

Expand Down

0 comments on commit 514cbe9

Please sign in to comment.