From: Albert Lee Date: Sun, 9 Oct 2005 13:46:07 +0000 (-0400) Subject: [libata irq-pio] reorganize ata_pio_sector() and __atapi_pio_bytes() X-Git-Tag: v2.6.18-rc1~1079^2~98^2~13^2~96 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7282aa4b49d08254ff1dcefdf3a2fb01b02ebbe2;p=karo-tx-linux.git [libata irq-pio] reorganize ata_pio_sector() and __atapi_pio_bytes() - move some code out of the kmap_atomic() / kunmap_atomic() zone - remove the redundant "do_write = (qc->tf.flags & ATA_TFLAG_WRITE);" Signed-off-by: Albert Lee --- diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 2c9275e30cb9..f89312654791 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -2763,22 +2763,21 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) local_irq_save(flags); buf = kmap_atomic(page, KM_IRQ0) + offset; - qc->cursect++; - qc->cursg_ofs++; - - if ((qc->cursg_ofs * ATA_SECT_SIZE) == (&sg[qc->cursg])->length) { - qc->cursg++; - qc->cursg_ofs = 0; - } - DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); /* do the actual data transfer */ - do_write = (qc->tf.flags & ATA_TFLAG_WRITE); ata_data_xfer(ap, buf, ATA_SECT_SIZE, do_write); kunmap_atomic(buf - offset, KM_IRQ0); local_irq_restore(flags); + + qc->cursect++; + qc->cursg_ofs++; + + if ((qc->cursg_ofs * ATA_SECT_SIZE) == (&sg[qc->cursg])->length) { + qc->cursg++; + qc->cursg_ofs = 0; + } } /** @@ -2956,6 +2955,14 @@ next_sg: local_irq_save(flags); buf = kmap_atomic(page, KM_IRQ0) + offset; + DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); + + /* do the actual data transfer */ + ata_data_xfer(ap, buf, count, do_write); + + kunmap_atomic(buf - offset, KM_IRQ0); + local_irq_restore(flags); + bytes -= count; qc->curbytes += count; qc->cursg_ofs += count; @@ -2965,14 +2972,6 @@ next_sg: qc->cursg_ofs = 0; } - DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); - - /* do the actual data transfer */ - ata_data_xfer(ap, buf, count, do_write); - - kunmap_atomic(buf - offset, KM_IRQ0); - local_irq_restore(flags); - if (bytes) goto next_sg; }