[SCSI] NCR53c406a: 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>
This commit is contained in:
FUJITA Tomonori 2007-05-16 07:01:23 +09:00 committed by James Bottomley
parent 646158c203
commit 03cde46b6b

View file

@ -698,7 +698,7 @@ static int NCR53c406a_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
int i; int i;
VDEB(printk("NCR53c406a_queue called\n")); VDEB(printk("NCR53c406a_queue called\n"));
DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n", SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->target, SCpnt->lun, SCpnt->request_bufflen)); DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n", SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->target, SCpnt->lun, scsi_bufflen(SCpnt)));
#if 0 #if 0
VDEB(for (i = 0; i < SCpnt->cmd_len; i++) VDEB(for (i = 0; i < SCpnt->cmd_len; i++)
@ -785,8 +785,8 @@ static void NCR53c406a_intr(void *dev_id)
unsigned char status, int_reg; unsigned char status, int_reg;
#if USE_PIO #if USE_PIO
unsigned char pio_status; unsigned char pio_status;
struct scatterlist *sglist; struct scatterlist *sg;
unsigned int sgcount; int i;
#endif #endif
VDEB(printk("NCR53c406a_intr called\n")); VDEB(printk("NCR53c406a_intr called\n"));
@ -866,22 +866,18 @@ static void NCR53c406a_intr(void *dev_id)
current_SC->SCp.phase = data_out; current_SC->SCp.phase = data_out;
VDEB(printk("NCR53c406a: Data-Out phase\n")); VDEB(printk("NCR53c406a: Data-Out phase\n"));
outb(FLUSH_FIFO, CMD_REG); outb(FLUSH_FIFO, CMD_REG);
LOAD_DMA_COUNT(current_SC->request_bufflen); /* Max transfer size */ LOAD_DMA_COUNT(scsi_bufflen(current_SC)); /* Max transfer size */
#if USE_DMA /* No s/g support for DMA */ #if USE_DMA /* No s/g support for DMA */
NCR53c406a_dma_write(current_SC->request_buffer, current_SC->request_bufflen); NCR53c406a_dma_write(scsi_sglist(current_SC),
scsdi_bufflen(current_SC));
#endif /* USE_DMA */ #endif /* USE_DMA */
outb(TRANSFER_INFO | DMA_OP, CMD_REG); outb(TRANSFER_INFO | DMA_OP, CMD_REG);
#if USE_PIO #if USE_PIO
if (!current_SC->use_sg) /* Don't use scatter-gather */ scsi_for_each_sg(current_SC, sg, scsi_sg_count(current_SC), i) {
NCR53c406a_pio_write(current_SC->request_buffer, current_SC->request_bufflen); NCR53c406a_pio_write(page_address(sg->page) + sg->offset,
else { /* use scatter-gather */ sg->length);
sgcount = current_SC->use_sg; }
sglist = current_SC->request_buffer;
while (sgcount--) {
NCR53c406a_pio_write(page_address(sglist->page) + sglist->offset, sglist->length);
sglist++;
}
}
REG0; REG0;
#endif /* USE_PIO */ #endif /* USE_PIO */
} }
@ -893,22 +889,17 @@ static void NCR53c406a_intr(void *dev_id)
current_SC->SCp.phase = data_in; current_SC->SCp.phase = data_in;
VDEB(printk("NCR53c406a: Data-In phase\n")); VDEB(printk("NCR53c406a: Data-In phase\n"));
outb(FLUSH_FIFO, CMD_REG); outb(FLUSH_FIFO, CMD_REG);
LOAD_DMA_COUNT(current_SC->request_bufflen); /* Max transfer size */ LOAD_DMA_COUNT(scsi_bufflen(current_SC)); /* Max transfer size */
#if USE_DMA /* No s/g support for DMA */ #if USE_DMA /* No s/g support for DMA */
NCR53c406a_dma_read(current_SC->request_buffer, current_SC->request_bufflen); NCR53c406a_dma_read(scsi_sglist(current_SC),
scsdi_bufflen(current_SC));
#endif /* USE_DMA */ #endif /* USE_DMA */
outb(TRANSFER_INFO | DMA_OP, CMD_REG); outb(TRANSFER_INFO | DMA_OP, CMD_REG);
#if USE_PIO #if USE_PIO
if (!current_SC->use_sg) /* Don't use scatter-gather */ scsi_for_each_sg(current_SC, sg, scsi_sg_count(current_SC), i) {
NCR53c406a_pio_read(current_SC->request_buffer, current_SC->request_bufflen); NCR53c406a_pio_read(page_address(sg->page) + sg->offset,
else { /* Use scatter-gather */ sg->length);
sgcount = current_SC->use_sg; }
sglist = current_SC->request_buffer;
while (sgcount--) {
NCR53c406a_pio_read(page_address(sglist->page) + sglist->offset, sglist->length);
sglist++;
}
}
REG0; REG0;
#endif /* USE_PIO */ #endif /* USE_PIO */
} }