Skip to content

Commit

Permalink
[libata irq-pio] reorganize ata_pio_sector() and __atapi_pio_bytes()
Browse files Browse the repository at this point in the history
   - 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 <albertcc@tw.ibm.com>
  • Loading branch information
Albert Lee authored and Jeff Garzik committed Oct 9, 2005
1 parent f58f8be commit 7282aa4
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

/**
Expand Down Expand Up @@ -2956,6 +2955,14 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
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;
Expand All @@ -2965,14 +2972,6 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
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;
}
Expand Down

0 comments on commit 7282aa4

Please sign in to comment.