aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-scsi.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-01-22 23:09:36 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-26 22:33:49 -0500
commit77853bf2b48e34449e826a9ef4df5ea0dbe947f4 (patch)
treeb46a186c141c61f05352b7a1199b2940fd9a2065 /drivers/scsi/libata-scsi.c
parent4ba946e9d8e10fada7bbce527f6ea05842592e06 (diff)
[PATCH] libata: make the owner of a qc responsible for freeing it
qc used to be freed automatically on command completion. However, as a qc can carry information about its completion status, it can be useful to its owner/issuer after command completion. This patch makes freeing qc responsibility of its owner. This simplifies ata_exec_internal() and makes command turn-around for atapi request sensing less hackish. This change was originally suggested by Jeff Garzik. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r--drivers/scsi/libata-scsi.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 0e65bfe92e6f..ce3fe928a386 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -1219,7 +1219,7 @@ nothing_to_do:
1219 return 1; 1219 return 1;
1220} 1220}
1221 1221
1222static int ata_scsi_qc_complete(struct ata_queued_cmd *qc) 1222static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1223{ 1223{
1224 struct scsi_cmnd *cmd = qc->scsicmd; 1224 struct scsi_cmnd *cmd = qc->scsicmd;
1225 u8 *cdb = cmd->cmnd; 1225 u8 *cdb = cmd->cmnd;
@@ -1256,7 +1256,7 @@ static int ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1256 1256
1257 qc->scsidone(cmd); 1257 qc->scsidone(cmd);
1258 1258
1259 return 0; 1259 ata_qc_free(qc);
1260} 1260}
1261 1261
1262/** 1262/**
@@ -1982,7 +1982,7 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8
1982 done(cmd); 1982 done(cmd);
1983} 1983}
1984 1984
1985static int atapi_sense_complete(struct ata_queued_cmd *qc) 1985static void atapi_sense_complete(struct ata_queued_cmd *qc)
1986{ 1986{
1987 if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) 1987 if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0))
1988 /* FIXME: not quite right; we don't want the 1988 /* FIXME: not quite right; we don't want the
@@ -1993,7 +1993,7 @@ static int atapi_sense_complete(struct ata_queued_cmd *qc)
1993 ata_gen_ata_desc_sense(qc); 1993 ata_gen_ata_desc_sense(qc);
1994 1994
1995 qc->scsidone(qc->scsicmd); 1995 qc->scsidone(qc->scsicmd);
1996 return 0; 1996 ata_qc_free(qc);
1997} 1997}
1998 1998
1999/* is it pointless to prefer PIO for "safety reasons"? */ 1999/* is it pointless to prefer PIO for "safety reasons"? */
@@ -2050,7 +2050,7 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
2050 DPRINTK("EXIT\n"); 2050 DPRINTK("EXIT\n");
2051} 2051}
2052 2052
2053static int atapi_qc_complete(struct ata_queued_cmd *qc) 2053static void atapi_qc_complete(struct ata_queued_cmd *qc)
2054{ 2054{
2055 struct scsi_cmnd *cmd = qc->scsicmd; 2055 struct scsi_cmnd *cmd = qc->scsicmd;
2056 unsigned int err_mask = qc->err_mask; 2056 unsigned int err_mask = qc->err_mask;
@@ -2060,7 +2060,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc)
2060 if (unlikely(err_mask & AC_ERR_DEV)) { 2060 if (unlikely(err_mask & AC_ERR_DEV)) {
2061 cmd->result = SAM_STAT_CHECK_CONDITION; 2061 cmd->result = SAM_STAT_CHECK_CONDITION;
2062 atapi_request_sense(qc); 2062 atapi_request_sense(qc);
2063 return 1; 2063 return;
2064 } 2064 }
2065 2065
2066 else if (unlikely(err_mask)) 2066 else if (unlikely(err_mask))
@@ -2100,7 +2100,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc)
2100 } 2100 }
2101 2101
2102 qc->scsidone(cmd); 2102 qc->scsidone(cmd);
2103 return 0; 2103 ata_qc_free(qc);
2104} 2104}
2105/** 2105/**
2106 * atapi_xlat - Initialize PACKET taskfile 2106 * atapi_xlat - Initialize PACKET taskfile