Commit 772a5c3f authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] sym53c416: 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: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 03cde46b
...@@ -332,8 +332,7 @@ static irqreturn_t sym53c416_intr_handle(int irq, void *dev_id) ...@@ -332,8 +332,7 @@ static irqreturn_t sym53c416_intr_handle(int irq, void *dev_id)
int i; int i;
unsigned long flags = 0; unsigned long flags = 0;
unsigned char status_reg, pio_int_reg, int_reg; unsigned char status_reg, pio_int_reg, int_reg;
struct scatterlist *sglist; struct scatterlist *sg;
unsigned int sgcount;
unsigned int tot_trans = 0; unsigned int tot_trans = 0;
/* We search the base address of the host adapter which caused the interrupt */ /* We search the base address of the host adapter which caused the interrupt */
...@@ -429,19 +428,15 @@ static irqreturn_t sym53c416_intr_handle(int irq, void *dev_id) ...@@ -429,19 +428,15 @@ static irqreturn_t sym53c416_intr_handle(int irq, void *dev_id)
{ {
current_command->SCp.phase = data_out; current_command->SCp.phase = data_out;
outb(FLUSH_FIFO, base + COMMAND_REG); outb(FLUSH_FIFO, base + COMMAND_REG);
sym53c416_set_transfer_counter(base, current_command->request_bufflen); sym53c416_set_transfer_counter(base,
scsi_bufflen(current_command));
outb(TRANSFER_INFORMATION | PIO_MODE, base + COMMAND_REG); outb(TRANSFER_INFORMATION | PIO_MODE, base + COMMAND_REG);
if(!current_command->use_sg)
tot_trans = sym53c416_write(base, current_command->request_buffer, current_command->request_bufflen); scsi_for_each_sg(current_command,
else sg, scsi_sg_count(current_command), i) {
{ tot_trans += sym53c416_write(base,
sgcount = current_command->use_sg; SG_ADDRESS(sg),
sglist = current_command->request_buffer; sg->length);
while(sgcount--)
{
tot_trans += sym53c416_write(base, SG_ADDRESS(sglist), sglist->length);
sglist++;
}
} }
if(tot_trans < current_command->underflow) if(tot_trans < current_command->underflow)
printk(KERN_WARNING "sym53c416: Underflow, wrote %d bytes, request for %d bytes.\n", tot_trans, current_command->underflow); printk(KERN_WARNING "sym53c416: Underflow, wrote %d bytes, request for %d bytes.\n", tot_trans, current_command->underflow);
...@@ -455,19 +450,16 @@ static irqreturn_t sym53c416_intr_handle(int irq, void *dev_id) ...@@ -455,19 +450,16 @@ static irqreturn_t sym53c416_intr_handle(int irq, void *dev_id)
{ {
current_command->SCp.phase = data_in; current_command->SCp.phase = data_in;
outb(FLUSH_FIFO, base + COMMAND_REG); outb(FLUSH_FIFO, base + COMMAND_REG);
sym53c416_set_transfer_counter(base, current_command->request_bufflen); sym53c416_set_transfer_counter(base,
scsi_bufflen(current_command));
outb(TRANSFER_INFORMATION | PIO_MODE, base + COMMAND_REG); outb(TRANSFER_INFORMATION | PIO_MODE, base + COMMAND_REG);
if(!current_command->use_sg)
tot_trans = sym53c416_read(base, current_command->request_buffer, current_command->request_bufflen); scsi_for_each_sg(current_command,
else sg, scsi_sg_count(current_command), i) {
{ tot_trans += sym53c416_read(base,
sgcount = current_command->use_sg; SG_ADDRESS(sg),
sglist = current_command->request_buffer; sg->length);
while(sgcount--)
{
tot_trans += sym53c416_read(base, SG_ADDRESS(sglist), sglist->length);
sglist++;
}
} }
if(tot_trans < current_command->underflow) if(tot_trans < current_command->underflow)
printk(KERN_WARNING "sym53c416: Underflow, read %d bytes, request for %d bytes.\n", tot_trans, current_command->underflow); printk(KERN_WARNING "sym53c416: Underflow, read %d bytes, request for %d bytes.\n", tot_trans, current_command->underflow);
......
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