Skip to content

Commit

Permalink
x86/amd-iommu: Move compl-wait command building to own function
Browse files Browse the repository at this point in the history
This patch introduces a seperate function for building
completion-wait commands.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
  • Loading branch information
Joerg Roedel committed Apr 6, 2011
1 parent 6221f22 commit ded4673
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,13 @@ irqreturn_t amd_iommu_int_handler(int irq, void *data)
*
****************************************************************************/

static void build_completion_wait(struct iommu_cmd *cmd)
{
memset(cmd, 0, sizeof(*cmd));
cmd->data[0] = CMD_COMPL_WAIT_INT_MASK;
CMD_SET_TYPE(cmd, CMD_COMPL_WAIT);
}

/*
* Writes the command to the IOMMUs command buffer and informs the
* hardware about the new command. Must be called with iommu->lock held.
Expand Down Expand Up @@ -458,9 +465,7 @@ static int __iommu_completion_wait(struct amd_iommu *iommu)
{
struct iommu_cmd cmd;

memset(&cmd, 0, sizeof(cmd));
cmd.data[0] = CMD_COMPL_WAIT_INT_MASK;
CMD_SET_TYPE(&cmd, CMD_COMPL_WAIT);
build_completion_wait(&cmd);

return __iommu_queue_command(iommu, &cmd);
}
Expand Down

0 comments on commit ded4673

Please sign in to comment.