Skip to content

Commit

Permalink
firmware: move completing fw into a helper
Browse files Browse the repository at this point in the history
This will be re-used later through a new extensible interface.

Reviewed-by: Josh Boyer <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
Signed-off-by: Mimi Zohar <[email protected]>
Acked-by: Kees Cook <[email protected]>
  • Loading branch information
mcgrof authored and Mimi Zohar committed Feb 18, 2016
1 parent ed04630 commit 5275d19
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions drivers/base/firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,15 @@ static int fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf)
return rc;
}

static void fw_finish_direct_load(struct device *device,
struct firmware_buf *buf)
{
mutex_lock(&fw_lock);
set_bit(FW_STATUS_DONE, &buf->status);
complete_all(&buf->completion);
mutex_unlock(&fw_lock);
}

static int fw_get_filesystem_firmware(struct device *device,
struct firmware_buf *buf)
{
Expand Down Expand Up @@ -363,10 +372,7 @@ static int fw_get_filesystem_firmware(struct device *device,
if (!rc) {
dev_dbg(device, "direct-loading %s\n",
buf->fw_id);
mutex_lock(&fw_lock);
set_bit(FW_STATUS_DONE, &buf->status);
complete_all(&buf->completion);
mutex_unlock(&fw_lock);
fw_finish_direct_load(device, buf);
}

return rc;
Expand Down

0 comments on commit 5275d19

Please sign in to comment.