1367static void
1368megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
1369 u8 alt_status)
1370{
1371 int exception = 0;
1372 struct megasas_header *hdr = &cmd->frame->hdr;
1373
1374 if (cmd->scmd)
1375 cmd->scmd->SCp.ptr = NULL;
1376
1377 switch (hdr->cmd) {
1378
1379 case MFI_CMD_PD_SCSI_IO:
1380 case MFI_CMD_LD_SCSI_IO:
1381
1382
1383
1384
1385
1386
1387 if (cmd->sync_cmd) {
1388 cmd->sync_cmd = 0;
1389 megasas_complete_int_cmd(instance, cmd);
1390 break;
1391 }
1392
1393 case MFI_CMD_LD_READ:
1394 case MFI_CMD_LD_WRITE:
1395
1396 if (alt_status) {
1397 cmd->scmd->result = alt_status << 16;
1398 exception = 1;
1399 }
1400
1401 if (exception) {
1402
1403 atomic_dec(&instance->fw_outstanding);
1404
1405 scsi_dma_unmap(cmd->scmd);
1406 cmd->scmd->scsi_done(cmd->scmd);
1407 megasas_return_cmd(instance, cmd);