Commit 385d70b4 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] qla2xxx: convert to use the data buffer accessors

- remove the unnecessary map_single path.

- convert to use the new accessors for the sg lists and the
parameters.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b1192d5e
...@@ -1411,9 +1411,9 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd) ...@@ -1411,9 +1411,9 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
printk("0x%02x ", cmd->cmnd[i]); printk("0x%02x ", cmd->cmnd[i]);
} }
printk("\n seg_cnt=%d, allowed=%d, retries=%d\n", printk("\n seg_cnt=%d, allowed=%d, retries=%d\n",
cmd->use_sg, cmd->allowed, cmd->retries); scsi_sg_count(cmd), cmd->allowed, cmd->retries);
printk(" request buffer=0x%p, request buffer len=0x%x\n", printk(" request buffer=0x%p, request buffer len=0x%x\n",
cmd->request_buffer, cmd->request_bufflen); scsi_sglist(cmd), scsi_bufflen(cmd));
printk(" tag=%d, transfersize=0x%x\n", printk(" tag=%d, transfersize=0x%x\n",
cmd->tag, cmd->transfersize); cmd->tag, cmd->transfersize);
printk(" serial_number=%lx, SP=%p\n", cmd->serial_number, sp); printk(" serial_number=%lx, SP=%p\n", cmd->serial_number, sp);
......
This diff is collapsed.
...@@ -889,19 +889,19 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) ...@@ -889,19 +889,19 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
} }
if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) { if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) {
resid = resid_len; resid = resid_len;
cp->resid = resid; scsi_set_resid(cp, resid);
CMD_RESID_LEN(cp) = resid; CMD_RESID_LEN(cp) = resid;
if (!lscsi_status && if (!lscsi_status &&
((unsigned)(cp->request_bufflen - resid) < ((unsigned)(scsi_bufflen(cp) - resid) <
cp->underflow)) { cp->underflow)) {
qla_printk(KERN_INFO, ha, qla_printk(KERN_INFO, ha,
"scsi(%ld:%d:%d:%d): Mid-layer underflow " "scsi(%ld:%d:%d:%d): Mid-layer underflow "
"detected (%x of %x bytes)...returning " "detected (%x of %x bytes)...returning "
"error status.\n", ha->host_no, "error status.\n", ha->host_no,
cp->device->channel, cp->device->id, cp->device->channel, cp->device->id,
cp->device->lun, resid, cp->device->lun, resid,
cp->request_bufflen); scsi_bufflen(cp));
cp->result = DID_ERROR << 16; cp->result = DID_ERROR << 16;
break; break;
...@@ -963,7 +963,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) ...@@ -963,7 +963,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
resid = fw_resid_len; resid = fw_resid_len;
if (scsi_status & SS_RESIDUAL_UNDER) { if (scsi_status & SS_RESIDUAL_UNDER) {
cp->resid = resid; scsi_set_resid(cp, resid);
CMD_RESID_LEN(cp) = resid; CMD_RESID_LEN(cp) = resid;
} else { } else {
DEBUG2(printk(KERN_INFO DEBUG2(printk(KERN_INFO
...@@ -1042,26 +1042,26 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) ...@@ -1042,26 +1042,26 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
*/ */
if (!(scsi_status & SS_RESIDUAL_UNDER)) { if (!(scsi_status & SS_RESIDUAL_UNDER)) {
DEBUG2(printk("scsi(%ld:%d:%d:%d) Dropped " DEBUG2(printk("scsi(%ld:%d:%d:%d) Dropped "
"frame(s) detected (%x of %x bytes)..." "frame(s) detected (%x of %x bytes)..."
"retrying command.\n", ha->host_no, "retrying command.\n", ha->host_no,
cp->device->channel, cp->device->id, cp->device->channel, cp->device->id,
cp->device->lun, resid, cp->device->lun, resid,
cp->request_bufflen)); scsi_bufflen(cp)));
cp->result = DID_BUS_BUSY << 16; cp->result = DID_BUS_BUSY << 16;
break; break;
} }
/* Handle mid-layer underflow */ /* Handle mid-layer underflow */
if ((unsigned)(cp->request_bufflen - resid) < if ((unsigned)(scsi_bufflen(cp) - resid) <
cp->underflow) { cp->underflow) {
qla_printk(KERN_INFO, ha, qla_printk(KERN_INFO, ha,
"scsi(%ld:%d:%d:%d): Mid-layer underflow " "scsi(%ld:%d:%d:%d): Mid-layer underflow "
"detected (%x of %x bytes)...returning " "detected (%x of %x bytes)...returning "
"error status.\n", ha->host_no, "error status.\n", ha->host_no,
cp->device->channel, cp->device->id, cp->device->channel, cp->device->id,
cp->device->lun, resid, cp->device->lun, resid,
cp->request_bufflen); scsi_bufflen(cp));
cp->result = DID_ERROR << 16; cp->result = DID_ERROR << 16;
break; break;
...@@ -1084,7 +1084,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) ...@@ -1084,7 +1084,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
DEBUG2(printk(KERN_INFO DEBUG2(printk(KERN_INFO
"PID=0x%lx req=0x%x xtra=0x%x -- returning DID_ERROR " "PID=0x%lx req=0x%x xtra=0x%x -- returning DID_ERROR "
"status!\n", "status!\n",
cp->serial_number, cp->request_bufflen, resid_len)); cp->serial_number, scsi_bufflen(cp), resid_len));
cp->result = DID_ERROR << 16; cp->result = DID_ERROR << 16;
break; break;
......
...@@ -2426,13 +2426,7 @@ qla2x00_sp_free_dma(scsi_qla_host_t *ha, srb_t *sp) ...@@ -2426,13 +2426,7 @@ qla2x00_sp_free_dma(scsi_qla_host_t *ha, srb_t *sp)
struct scsi_cmnd *cmd = sp->cmd; struct scsi_cmnd *cmd = sp->cmd;
if (sp->flags & SRB_DMA_VALID) { if (sp->flags & SRB_DMA_VALID) {
if (cmd->use_sg) { scsi_dma_unmap(cmd);
dma_unmap_sg(&ha->pdev->dev, cmd->request_buffer,
cmd->use_sg, cmd->sc_data_direction);
} else if (cmd->request_bufflen) {
dma_unmap_single(&ha->pdev->dev, sp->dma_handle,
cmd->request_bufflen, cmd->sc_data_direction);
}
sp->flags &= ~SRB_DMA_VALID; sp->flags &= ~SRB_DMA_VALID;
} }
CMD_SP(cmd) = NULL; CMD_SP(cmd) = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment