diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:36 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:36 -0400 |
commit | acaa0f5f675ccf6b8a3a11a933419068b1ea1f46 (patch) | |
tree | 8afee71c69bf765a5edd0de82c98c6470905ec20 /drivers/scsi | |
parent | c860f955681ebd83df4a03089f1910fc4b54651f (diff) |
ide: add ide_io_buffers() helper
* Make ->io_buffers method return number of bytes transferred.
* Use ide_end_request() instead of idefloppy_end_request()
in ide_floppy_io_buffers() and then move the call out to
ide_pc_intr().
* Add ide_io_buffers() helper and convert ide-{floppy,scsi}.c
to use it instead of ide*_io_buffers().
There should be no functional changes caused by this patch.
Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ide-scsi.c | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 26e8c3c49474..27c01e368977 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -130,50 +130,6 @@ static inline idescsi_scsi_t *drive_to_idescsi(ide_drive_t *ide_drive) | |||
130 | return scsihost_to_idescsi(ide_drive->driver_data); | 130 | return scsihost_to_idescsi(ide_drive->driver_data); |
131 | } | 131 | } |
132 | 132 | ||
133 | /* | ||
134 | * PIO data transfer routine using the scatter gather table. | ||
135 | */ | ||
136 | static void ide_scsi_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, | ||
137 | unsigned int bcount, int write) | ||
138 | { | ||
139 | ide_hwif_t *hwif = drive->hwif; | ||
140 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | ||
141 | xfer_func_t *xf = write ? tp_ops->output_data : tp_ops->input_data; | ||
142 | struct scatterlist *sg = pc->sg; | ||
143 | char *buf; | ||
144 | int count; | ||
145 | |||
146 | while (bcount) { | ||
147 | count = min(sg->length - pc->b_count, bcount); | ||
148 | if (PageHighMem(sg_page(sg))) { | ||
149 | unsigned long flags; | ||
150 | |||
151 | local_irq_save(flags); | ||
152 | buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; | ||
153 | xf(drive, NULL, buf + pc->b_count, count); | ||
154 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | ||
155 | local_irq_restore(flags); | ||
156 | } else { | ||
157 | buf = sg_virt(sg); | ||
158 | xf(drive, NULL, buf + pc->b_count, count); | ||
159 | } | ||
160 | bcount -= count; pc->b_count += count; | ||
161 | if (pc->b_count == sg->length) { | ||
162 | if (!--pc->sg_cnt) | ||
163 | break; | ||
164 | pc->sg = sg = sg_next(sg); | ||
165 | pc->b_count = 0; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | if (bcount) { | ||
170 | printk(KERN_ERR "%s: scatter gather table too small, %s\n", | ||
171 | drive->name, write ? "padding with zeros" | ||
172 | : "discarding data"); | ||
173 | ide_pad_transfer(drive, write, bcount); | ||
174 | } | ||
175 | } | ||
176 | |||
177 | static void ide_scsi_hex_dump(u8 *data, int len) | 133 | static void ide_scsi_hex_dump(u8 *data, int len) |
178 | { | 134 | { |
179 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0); | 135 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0); |
@@ -343,7 +299,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
343 | 299 | ||
344 | return ide_pc_intr(drive, pc, idescsi_pc_intr, get_timeout(pc), | 300 | return ide_pc_intr(drive, pc, idescsi_pc_intr, get_timeout(pc), |
345 | idescsi_expiry, NULL, NULL, NULL, | 301 | idescsi_expiry, NULL, NULL, NULL, |
346 | ide_scsi_io_buffers); | 302 | ide_io_buffers); |
347 | } | 303 | } |
348 | 304 | ||
349 | static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) | 305 | static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) |