diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2007-05-14 19:12:55 +0900 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-26 16:30:04 -0500 |
commit | 3258a4d5690880a62121553b604893ecaca7d042 (patch) | |
tree | 42c10b636283144b6e5f50c906b024534d2c3e30 /drivers/scsi/53c700.c | |
parent | 824d7b570b4dec49e868c251d670941b02a1e489 (diff) |
[SCSI] 53c700: 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.
Jens Axboe <jens.axboe@oracle.com> did the for_each_sg cleanup.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/53c700.c')
-rw-r--r-- | drivers/scsi/53c700.c | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index cb02656eb54c..405d9d6f9653 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -585,16 +585,8 @@ NCR_700_unmap(struct NCR_700_Host_Parameters *hostdata, struct scsi_cmnd *SCp, struct NCR_700_command_slot *slot) { if(SCp->sc_data_direction != DMA_NONE && - SCp->sc_data_direction != DMA_BIDIRECTIONAL) { - if(SCp->use_sg) { - dma_unmap_sg(hostdata->dev, SCp->request_buffer, - SCp->use_sg, SCp->sc_data_direction); - } else { - dma_unmap_single(hostdata->dev, slot->dma_handle, - SCp->request_bufflen, - SCp->sc_data_direction); - } - } + SCp->sc_data_direction != DMA_BIDIRECTIONAL) + scsi_dma_unmap(SCp); } STATIC inline void @@ -1263,14 +1255,13 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, host->host_no, pun, lun, NCR_700_condition[i], NCR_700_phase[j], dsp - hostdata->pScript); if(SCp != NULL) { - scsi_print_command(SCp); + struct scatterlist *sg; - if(SCp->use_sg) { - for(i = 0; i < SCp->use_sg + 1; i++) { - printk(KERN_INFO " SG[%d].length = %d, move_insn=%08x, addr %08x\n", i, ((struct scatterlist *)SCp->request_buffer)[i].length, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].ins, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].pAddr); - } + scsi_print_command(SCp); + scsi_for_each_sg(SCp, sg, scsi_sg_count(SCp) + 1, i) { + printk(KERN_INFO " SG[%d].length = %d, move_insn=%08x, addr %08x\n", i, sg->length, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].ins, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].pAddr); } - } + } NCR_700_internal_bus_reset(host); } else if((dsps & 0xfffff000) == A_DEBUG_INTERRUPT) { printk(KERN_NOTICE "scsi%d (%d:%d) DEBUG INTERRUPT %d AT %08x[%04x], continuing\n", @@ -1844,8 +1835,8 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) } /* sanity check: some of the commands generated by the mid-layer * have an eccentric idea of their sc_data_direction */ - if(!SCp->use_sg && !SCp->request_bufflen - && SCp->sc_data_direction != DMA_NONE) { + if(!scsi_sg_count(SCp) && !scsi_bufflen(SCp) && + SCp->sc_data_direction != DMA_NONE) { #ifdef NCR_700_DEBUG printk("53c700: Command"); scsi_print_command(SCp); @@ -1887,31 +1878,15 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) int i; int sg_count; dma_addr_t vPtr = 0; + struct scatterlist *sg; __u32 count = 0; - if(SCp->use_sg) { - sg_count = dma_map_sg(hostdata->dev, - SCp->request_buffer, SCp->use_sg, - direction); - } else { - vPtr = dma_map_single(hostdata->dev, - SCp->request_buffer, - SCp->request_bufflen, - direction); - count = SCp->request_bufflen; - slot->dma_handle = vPtr; - sg_count = 1; - } - + sg_count = scsi_dma_map(SCp); + BUG_ON(sg_count < 0); - for(i = 0; i < sg_count; i++) { - - if(SCp->use_sg) { - struct scatterlist *sg = SCp->request_buffer; - - vPtr = sg_dma_address(&sg[i]); - count = sg_dma_len(&sg[i]); - } + scsi_for_each_sg(SCp, sg, sg_count, i) { + vPtr = sg_dma_address(sg); + count = sg_dma_len(sg); slot->SG[i].ins = bS_to_host(move_ins | count); DEBUG((" scatter block %d: move %d[%08x] from 0x%lx\n", |