]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ata: libata-scsi: rename and improve ata_qc_done()
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 19 Feb 2026 01:58:40 +0000 (10:58 +0900)
committerDamien Le Moal <dlemoal@kernel.org>
Tue, 24 Feb 2026 00:40:58 +0000 (09:40 +0900)
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>
drivers/ata/libata-scsi.c

index ad628b398fc3773d36ca9c8395df7918091e4758..4225c6d7ff35977402c2e6a6ea513344557e761c 100644 (file)
@@ -1649,12 +1649,16 @@ nothing_to_do:
        return 1;
 }
 
-static void ata_qc_done(struct ata_queued_cmd *qc)
+static void ata_scsi_qc_done(struct ata_queued_cmd *qc, bool set_result,
+                            u32 scmd_result)
 {
        struct scsi_cmnd *cmd = qc->scsicmd;
        void (*done)(struct scsi_cmnd *) = qc->scsidone;
 
        ata_qc_free(qc);
+
+       if (set_result)
+               cmd->result = scmd_result;
        done(cmd);
 }
 
@@ -1693,12 +1697,10 @@ void ata_scsi_requeue_deferred_qc(struct ata_port *ap)
         * do not try to be smart about what to do with this deferred command
         * and simply retry it by completing it with DID_SOFT_ERROR.
         */
-       if (!qc)
-               return;
-
-       ap->deferred_qc = NULL;
-       qc->scsicmd->result = (DID_SOFT_ERROR << 16);
-       ata_qc_done(qc);
+       if (qc) {
+               ap->deferred_qc = NULL;
+               ata_scsi_qc_done(qc, true, DID_SOFT_ERROR << 16);
+       }
 }
 
 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)
                ata_scsi_set_sense_information(qc);
        }
 
-       ata_qc_done(qc);
+       ata_scsi_qc_done(qc, false, 0);
 
        ata_scsi_schedule_deferred_qc(ap);
 }
@@ -2913,17 +2915,15 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
                if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev)
                        qc->dev->sdev->locked = 0;
 
-               qc->scsicmd->result = SAM_STAT_CHECK_CONDITION;
-               ata_qc_done(qc);
+               ata_scsi_qc_done(qc, true, SAM_STAT_CHECK_CONDITION);
                return;
        }
 
        /* successful completion path */
        if (cmd->cmnd[0] == INQUIRY && (cmd->cmnd[1] & 0x03) == 0)
                atapi_fixup_inquiry(cmd);
-       cmd->result = SAM_STAT_GOOD;
 
-       ata_qc_done(qc);
+       ata_scsi_qc_done(qc, true, SAM_STAT_GOOD);
 }
 /**
  *     atapi_xlat - Initialize PACKET taskfile