diff options
-rw-r--r-- | drivers/scsi/libata-core.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 35ee35e176c0..5e750c33dd96 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -2748,7 +2748,6 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) | |||
2748 | struct page *page; | 2748 | struct page *page; |
2749 | unsigned int offset; | 2749 | unsigned int offset; |
2750 | unsigned char *buf; | 2750 | unsigned char *buf; |
2751 | unsigned long flags; | ||
2752 | 2751 | ||
2753 | if (qc->cursect == (qc->nsect - 1)) | 2752 | if (qc->cursect == (qc->nsect - 1)) |
2754 | ap->hsm_task_state = HSM_ST_LAST; | 2753 | ap->hsm_task_state = HSM_ST_LAST; |
@@ -2762,14 +2761,21 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) | |||
2762 | 2761 | ||
2763 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); | 2762 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); |
2764 | 2763 | ||
2765 | local_irq_save(flags); | 2764 | if (PageHighMem(page)) { |
2766 | buf = kmap_atomic(page, KM_IRQ0); | 2765 | unsigned long flags; |
2766 | |||
2767 | local_irq_save(flags); | ||
2768 | buf = kmap_atomic(page, KM_IRQ0); | ||
2767 | 2769 | ||
2768 | /* do the actual data transfer */ | 2770 | /* do the actual data transfer */ |
2769 | ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write); | 2771 | ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write); |
2770 | 2772 | ||
2771 | kunmap_atomic(buf, KM_IRQ0); | 2773 | kunmap_atomic(buf, KM_IRQ0); |
2772 | local_irq_restore(flags); | 2774 | local_irq_restore(flags); |
2775 | } else { | ||
2776 | buf = page_address(page); | ||
2777 | ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write); | ||
2778 | } | ||
2773 | 2779 | ||
2774 | qc->cursect++; | 2780 | qc->cursect++; |
2775 | qc->cursg_ofs++; | 2781 | qc->cursg_ofs++; |
@@ -2908,7 +2914,6 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) | |||
2908 | struct page *page; | 2914 | struct page *page; |
2909 | unsigned char *buf; | 2915 | unsigned char *buf; |
2910 | unsigned int offset, count; | 2916 | unsigned int offset, count; |
2911 | unsigned long flags; | ||
2912 | 2917 | ||
2913 | if (qc->curbytes + bytes >= qc->nbytes) | 2918 | if (qc->curbytes + bytes >= qc->nbytes) |
2914 | ap->hsm_task_state = HSM_ST_LAST; | 2919 | ap->hsm_task_state = HSM_ST_LAST; |
@@ -2954,14 +2959,21 @@ next_sg: | |||
2954 | 2959 | ||
2955 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); | 2960 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); |
2956 | 2961 | ||
2957 | local_irq_save(flags); | 2962 | if (PageHighMem(page)) { |
2958 | buf = kmap_atomic(page, KM_IRQ0); | 2963 | unsigned long flags; |
2964 | |||
2965 | local_irq_save(flags); | ||
2966 | buf = kmap_atomic(page, KM_IRQ0); | ||
2959 | 2967 | ||
2960 | /* do the actual data transfer */ | 2968 | /* do the actual data transfer */ |
2961 | ata_data_xfer(ap, buf + offset, count, do_write); | 2969 | ata_data_xfer(ap, buf + offset, count, do_write); |
2962 | 2970 | ||
2963 | kunmap_atomic(buf, KM_IRQ0); | 2971 | kunmap_atomic(buf, KM_IRQ0); |
2964 | local_irq_restore(flags); | 2972 | local_irq_restore(flags); |
2973 | } else { | ||
2974 | buf = page_address(page); | ||
2975 | ata_data_xfer(ap, buf + offset, count, do_write); | ||
2976 | } | ||
2965 | 2977 | ||
2966 | bytes -= count; | 2978 | bytes -= count; |
2967 | qc->curbytes += count; | 2979 | qc->curbytes += count; |