Skip to content

Commit 99d6b90

Browse files
committed
ata: libata-scsi: rename and improve ata_qc_done()
Rename ata_qc_done() to ata_scsi_qc_done() and allow to pass a scsi command result value to set for the completed command to simplify the caller sites. No functional changes. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de>
1 parent fa4f81a commit 99d6b90

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

drivers/ata/libata-scsi.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,12 +1649,16 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
16491649
return 1;
16501650
}
16511651

1652-
static void ata_qc_done(struct ata_queued_cmd *qc)
1652+
static void ata_scsi_qc_done(struct ata_queued_cmd *qc, bool set_result,
1653+
u32 scmd_result)
16531654
{
16541655
struct scsi_cmnd *cmd = qc->scsicmd;
16551656
void (*done)(struct scsi_cmnd *) = qc->scsidone;
16561657

16571658
ata_qc_free(qc);
1659+
1660+
if (set_result)
1661+
cmd->result = scmd_result;
16581662
done(cmd);
16591663
}
16601664

@@ -1693,12 +1697,10 @@ void ata_scsi_requeue_deferred_qc(struct ata_port *ap)
16931697
* do not try to be smart about what to do with this deferred command
16941698
* and simply retry it by completing it with DID_SOFT_ERROR.
16951699
*/
1696-
if (!qc)
1697-
return;
1698-
1699-
ap->deferred_qc = NULL;
1700-
qc->scsicmd->result = (DID_SOFT_ERROR << 16);
1701-
ata_qc_done(qc);
1700+
if (qc) {
1701+
ap->deferred_qc = NULL;
1702+
ata_scsi_qc_done(qc, true, DID_SOFT_ERROR << 16);
1703+
}
17021704
}
17031705

17041706
static void ata_scsi_schedule_deferred_qc(struct ata_port *ap)
@@ -1754,7 +1756,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
17541756
ata_scsi_set_sense_information(qc);
17551757
}
17561758

1757-
ata_qc_done(qc);
1759+
ata_scsi_qc_done(qc, false, 0);
17581760

17591761
ata_scsi_schedule_deferred_qc(ap);
17601762
}
@@ -2913,17 +2915,15 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
29132915
if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev)
29142916
qc->dev->sdev->locked = 0;
29152917

2916-
qc->scsicmd->result = SAM_STAT_CHECK_CONDITION;
2917-
ata_qc_done(qc);
2918+
ata_scsi_qc_done(qc, true, SAM_STAT_CHECK_CONDITION);
29182919
return;
29192920
}
29202921

29212922
/* successful completion path */
29222923
if (cmd->cmnd[0] == INQUIRY && (cmd->cmnd[1] & 0x03) == 0)
29232924
atapi_fixup_inquiry(cmd);
2924-
cmd->result = SAM_STAT_GOOD;
29252925

2926-
ata_qc_done(qc);
2926+
ata_scsi_qc_done(qc, true, SAM_STAT_GOOD);
29272927
}
29282928
/**
29292929
* atapi_xlat - Initialize PACKET taskfile

0 commit comments

Comments
 (0)