ide-scsi: cleanup ide_scsi_io_buffers()
Preparation for ide_{floppy,scsi}_io_buffers() unification. Acked-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
4de4b9e140
commit
c860f95568
1 changed files with 8 additions and 8 deletions
|
@ -139,29 +139,29 @@ static void ide_scsi_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
|
||||||
ide_hwif_t *hwif = drive->hwif;
|
ide_hwif_t *hwif = drive->hwif;
|
||||||
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
|
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
|
||||||
xfer_func_t *xf = write ? tp_ops->output_data : tp_ops->input_data;
|
xfer_func_t *xf = write ? tp_ops->output_data : tp_ops->input_data;
|
||||||
|
struct scatterlist *sg = pc->sg;
|
||||||
char *buf;
|
char *buf;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
while (bcount) {
|
while (bcount) {
|
||||||
count = min(pc->sg->length - pc->b_count, bcount);
|
count = min(sg->length - pc->b_count, bcount);
|
||||||
if (PageHighMem(sg_page(pc->sg))) {
|
if (PageHighMem(sg_page(sg))) {
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) +
|
buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset;
|
||||||
pc->sg->offset;
|
|
||||||
xf(drive, NULL, buf + pc->b_count, count);
|
xf(drive, NULL, buf + pc->b_count, count);
|
||||||
kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
|
kunmap_atomic(buf - sg->offset, KM_IRQ0);
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
} else {
|
} else {
|
||||||
buf = sg_virt(pc->sg);
|
buf = sg_virt(sg);
|
||||||
xf(drive, NULL, buf + pc->b_count, count);
|
xf(drive, NULL, buf + pc->b_count, count);
|
||||||
}
|
}
|
||||||
bcount -= count; pc->b_count += count;
|
bcount -= count; pc->b_count += count;
|
||||||
if (pc->b_count == pc->sg->length) {
|
if (pc->b_count == sg->length) {
|
||||||
if (!--pc->sg_cnt)
|
if (!--pc->sg_cnt)
|
||||||
break;
|
break;
|
||||||
pc->sg = sg_next(pc->sg);
|
pc->sg = sg = sg_next(sg);
|
||||||
pc->b_count = 0;
|
pc->b_count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue