static void megasas_command_complete(SCSIRequest *req, uint32_t status,

                                     size_t resid)

{

    MegasasCmd *cmd = req->hba_private;

    uint8_t cmd_status = MFI_STAT_OK;



    trace_megasas_command_complete(cmd->index, status, resid);



    if (req->io_canceled) {

        return;

    }



    if (cmd->req == NULL) {

        /*

         * Internal command complete

         */

        cmd_status = megasas_finish_internal_dcmd(cmd, req, resid);

        if (cmd_status == MFI_STAT_INVALID_STATUS) {

            return;

        }

    } else {

        req->status = status;

        trace_megasas_scsi_complete(cmd->index, req->status,

                                    cmd->iov_size, req->cmd.xfer);

        if (req->status != GOOD) {

            cmd_status = MFI_STAT_SCSI_DONE_WITH_ERROR;

        }

        if (req->status == CHECK_CONDITION) {

            megasas_copy_sense(cmd);

        }



        cmd->frame->header.scsi_status = req->status;

    }

    cmd->frame->header.cmd_status = cmd_status;

    megasas_complete_command(cmd);

}

static void megasas_command_complete(SCSIRequest *req, uint32_t status,

                                     size_t resid)

{

    MegasasCmd *cmd = req->hba_private;

    uint8_t cmd_status = MFI_STAT_OK;



    trace_megasas_command_complete(cmd->index, status, resid);



    if (req->io_canceled) {

        return;

    }



    if (cmd->req == NULL) {

        





        cmd_status = megasas_finish_internal_dcmd(cmd, req, resid);

        if (cmd_status == MFI_STAT_INVALID_STATUS) {

            return;

        }

    } else {

        req->status = status;

        trace_megasas_scsi_complete(cmd->index, req->status,

                                    cmd->iov_size, req->cmd.xfer);

        if (req->status != GOOD) {

            cmd_status = MFI_STAT_SCSI_DONE_WITH_ERROR;

        }

        if (req->status == CHECK_CONDITION) {

            megasas_copy_sense(cmd);

        }



        cmd->frame->header.scsi_status = req->status;

    }

    cmd->frame->header.cmd_status = cmd_status;

    megasas_complete_command(cmd);

}

    if (cmd->req == NULL) {
static void FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1,

                                     size_t VAR_2)

{

    MegasasCmd *cmd = VAR_0->hba_private;

    uint8_t cmd_status = MFI_STAT_OK;



    trace_megasas_command_complete(cmd->index, VAR_1, VAR_2);



    if (VAR_0->io_canceled) {

        return;

    }



    if (cmd->VAR_0 == NULL) {

        





        cmd_status = megasas_finish_internal_dcmd(cmd, VAR_0, VAR_2);

        if (cmd_status == MFI_STAT_INVALID_STATUS) {

            return;

        }

    } else {

        VAR_0->VAR_1 = VAR_1;

        trace_megasas_scsi_complete(cmd->index, VAR_0->VAR_1,

                                    cmd->iov_size, VAR_0->cmd.xfer);

        if (VAR_0->VAR_1 != GOOD) {

            cmd_status = MFI_STAT_SCSI_DONE_WITH_ERROR;

        }

        if (VAR_0->VAR_1 == CHECK_CONDITION) {

            megasas_copy_sense(cmd);

        }



        cmd->frame->header.scsi_status = VAR_0->VAR_1;

    }

    cmd->frame->header.cmd_status = cmd_status;

    megasas_complete_command(cmd);

}

static void FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1,
size_t VAR_2)
{ MegasasCmd *cmd = VAR_0->hba_private; uint8_t cmd_status = MFI_STAT_OK; trace_megasas_command_complete(cmd->index, VAR_1, VAR_2); if (VAR_0->io_canceled) { return; } if (cmd->VAR_0 == NULL) { cmd_status = megasas_finish_internal_dcmd(cmd, VAR_0, VAR_2); if (cmd_status == MFI_STAT_INVALID_STATUS) { return; } } else { VAR_0->VAR_1 = VAR_1; trace_megasas_scsi_complete(cmd->index, VAR_0->VAR_1,
cmd->iov_size, VAR_0->cmd.xfer); if (VAR_0->VAR_1 != GOOD) { cmd_status = MFI_STAT_SCSI_DONE_WITH_ERROR; } if (VAR_0->VAR_1 == CHECK_CONDITION) { megasas_copy_sense(cmd); } cmd->frame->header.scsi_status = VAR_0->VAR_1; } cmd->frame->header.cmd_status = cmd_status; megasas_complete_command(cmd); }