diff options
author | Albert Lee <albertcc@tw.ibm.com> | 2005-10-09 09:46:07 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-09 09:46:07 -0400 |
commit | 7282aa4b49d08254ff1dcefdf3a2fb01b02ebbe2 (patch) | |
tree | 37cba0515abcbf19190acd58f4a74227050a5b4d /drivers/scsi/libata-core.c | |
parent | f58f8be7f65312f602f7970e7da47a6413e692b0 (diff) |
[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 <albertcc@tw.ibm.com>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 33 |
1 files changed, 16 insertions, 17 deletions
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) | |||
2763 | local_irq_save(flags); | 2763 | local_irq_save(flags); |
2764 | buf = kmap_atomic(page, KM_IRQ0) + offset; | 2764 | buf = kmap_atomic(page, KM_IRQ0) + offset; |
2765 | 2765 | ||
2766 | qc->cursect++; | ||
2767 | qc->cursg_ofs++; | ||
2768 | |||
2769 | if ((qc->cursg_ofs * ATA_SECT_SIZE) == (&sg[qc->cursg])->length) { | ||
2770 | qc->cursg++; | ||
2771 | qc->cursg_ofs = 0; | ||
2772 | } | ||
2773 | |||
2774 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); | 2766 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); |
2775 | 2767 | ||
2776 | /* do the actual data transfer */ | 2768 | /* do the actual data transfer */ |
2777 | do_write = (qc->tf.flags & ATA_TFLAG_WRITE); | ||
2778 | ata_data_xfer(ap, buf, ATA_SECT_SIZE, do_write); | 2769 | ata_data_xfer(ap, buf, ATA_SECT_SIZE, do_write); |
2779 | 2770 | ||
2780 | kunmap_atomic(buf - offset, KM_IRQ0); | 2771 | kunmap_atomic(buf - offset, KM_IRQ0); |
2781 | local_irq_restore(flags); | 2772 | local_irq_restore(flags); |
2773 | |||
2774 | qc->cursect++; | ||
2775 | qc->cursg_ofs++; | ||
2776 | |||
2777 | if ((qc->cursg_ofs * ATA_SECT_SIZE) == (&sg[qc->cursg])->length) { | ||
2778 | qc->cursg++; | ||
2779 | qc->cursg_ofs = 0; | ||
2780 | } | ||
2782 | } | 2781 | } |
2783 | 2782 | ||
2784 | /** | 2783 | /** |
@@ -2956,6 +2955,14 @@ next_sg: | |||
2956 | local_irq_save(flags); | 2955 | local_irq_save(flags); |
2957 | buf = kmap_atomic(page, KM_IRQ0) + offset; | 2956 | buf = kmap_atomic(page, KM_IRQ0) + offset; |
2958 | 2957 | ||
2958 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); | ||
2959 | |||
2960 | /* do the actual data transfer */ | ||
2961 | ata_data_xfer(ap, buf, count, do_write); | ||
2962 | |||
2963 | kunmap_atomic(buf - offset, KM_IRQ0); | ||
2964 | local_irq_restore(flags); | ||
2965 | |||
2959 | bytes -= count; | 2966 | bytes -= count; |
2960 | qc->curbytes += count; | 2967 | qc->curbytes += count; |
2961 | qc->cursg_ofs += count; | 2968 | qc->cursg_ofs += count; |
@@ -2965,14 +2972,6 @@ next_sg: | |||
2965 | qc->cursg_ofs = 0; | 2972 | qc->cursg_ofs = 0; |
2966 | } | 2973 | } |
2967 | 2974 | ||
2968 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); | ||
2969 | |||
2970 | /* do the actual data transfer */ | ||
2971 | ata_data_xfer(ap, buf, count, do_write); | ||
2972 | |||
2973 | kunmap_atomic(buf - offset, KM_IRQ0); | ||
2974 | local_irq_restore(flags); | ||
2975 | |||
2976 | if (bytes) | 2975 | if (bytes) |
2977 | goto next_sg; | 2976 | goto next_sg; |
2978 | } | 2977 | } |