aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ide-scsi.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:36 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:36 -0400
commit9567b349f7e7dd7e2483db99ee8e4a6fe0caca38 (patch)
tree29abab829b52a451567f8da4280d101fafa44527 /drivers/scsi/ide-scsi.c
parent92d3ab27e8fd23d1a9dc3b69d17b2afb83e5c6f5 (diff)
ide: merge ->atapi_*put_bytes and ->ata_*put_data methods
* Merge ->atapi_{in,out}put_bytes and ->ata_{in,out}put_data methods into new ->{in,out}put_data methods which take number of bytes to transfer as an argument and always do padding. While at it: * Use 'hwif' or 'drive->hwif' instead of 'HWIF(drive)'. There should be no functional changes caused by this patch (all users of ->ata_{in,out}put_data methods were using multiply-of-4 word counts). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/scsi/ide-scsi.c')
-rw-r--r--drivers/scsi/ide-scsi.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 32553639aded..1168fb0a713c 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -134,6 +134,7 @@ static inline idescsi_scsi_t *drive_to_idescsi(ide_drive_t *ide_drive)
134static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, 134static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
135 unsigned int bcount) 135 unsigned int bcount)
136{ 136{
137 ide_hwif_t *hwif = drive->hwif;
137 int count; 138 int count;
138 char *buf; 139 char *buf;
139 140
@@ -145,14 +146,12 @@ static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
145 local_irq_save(flags); 146 local_irq_save(flags);
146 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) + 147 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) +
147 pc->sg->offset; 148 pc->sg->offset;
148 drive->hwif->atapi_input_bytes(drive, 149 hwif->input_data(drive, NULL, buf + pc->b_count, count);
149 buf + pc->b_count, count);
150 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); 150 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
151 local_irq_restore(flags); 151 local_irq_restore(flags);
152 } else { 152 } else {
153 buf = sg_virt(pc->sg); 153 buf = sg_virt(pc->sg);
154 drive->hwif->atapi_input_bytes(drive, 154 hwif->input_data(drive, NULL, buf + pc->b_count, count);
155 buf + pc->b_count, count);
156 } 155 }
157 bcount -= count; pc->b_count += count; 156 bcount -= count; pc->b_count += count;
158 if (pc->b_count == pc->sg->length) { 157 if (pc->b_count == pc->sg->length) {
@@ -172,6 +171,7 @@ static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
172static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, 171static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
173 unsigned int bcount) 172 unsigned int bcount)
174{ 173{
174 ide_hwif_t *hwif = drive->hwif;
175 int count; 175 int count;
176 char *buf; 176 char *buf;
177 177
@@ -183,14 +183,12 @@ static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
183 local_irq_save(flags); 183 local_irq_save(flags);
184 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) + 184 buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) +
185 pc->sg->offset; 185 pc->sg->offset;
186 drive->hwif->atapi_output_bytes(drive, 186 hwif->output_data(drive, NULL, buf + pc->b_count, count);
187 buf + pc->b_count, count);
188 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); 187 kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
189 local_irq_restore(flags); 188 local_irq_restore(flags);
190 } else { 189 } else {
191 buf = sg_virt(pc->sg); 190 buf = sg_virt(pc->sg);
192 drive->hwif->atapi_output_bytes(drive, 191 hwif->output_data(drive, NULL, buf + pc->b_count, count);
193 buf + pc->b_count, count);
194 } 192 }
195 bcount -= count; pc->b_count += count; 193 bcount -= count; pc->b_count += count;
196 if (pc->b_count == pc->sg->length) { 194 if (pc->b_count == pc->sg->length) {
@@ -431,7 +429,8 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
431 idescsi_input_buffers(drive, pc, 429 idescsi_input_buffers(drive, pc,
432 temp); 430 temp);
433 else 431 else
434 drive->hwif->atapi_input_bytes(drive, pc->cur_pos, temp); 432 hwif->input_data(drive, NULL,
433 pc->cur_pos, temp);
435 printk(KERN_ERR "ide-scsi: transferred" 434 printk(KERN_ERR "ide-scsi: transferred"
436 " %d of %d bytes\n", 435 " %d of %d bytes\n",
437 temp, bcount); 436 temp, bcount);
@@ -452,15 +451,13 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
452 if (pc->sg) 451 if (pc->sg)
453 idescsi_input_buffers(drive, pc, bcount); 452 idescsi_input_buffers(drive, pc, bcount);
454 else 453 else
455 hwif->atapi_input_bytes(drive, pc->cur_pos, 454 hwif->input_data(drive, NULL, pc->cur_pos, bcount);
456 bcount);
457 } else { 455 } else {
458 pc->flags |= PC_FLAG_WRITING; 456 pc->flags |= PC_FLAG_WRITING;
459 if (pc->sg) 457 if (pc->sg)
460 idescsi_output_buffers(drive, pc, bcount); 458 idescsi_output_buffers(drive, pc, bcount);
461 else 459 else
462 hwif->atapi_output_bytes(drive, pc->cur_pos, 460 hwif->output_data(drive, NULL, pc->cur_pos, bcount);
463 bcount);
464 } 461 }
465 /* Update the current position */ 462 /* Update the current position */
466 pc->xferred += bcount; 463 pc->xferred += bcount;
@@ -493,8 +490,10 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
493 BUG_ON(HWGROUP(drive)->handler != NULL); 490 BUG_ON(HWGROUP(drive)->handler != NULL);
494 /* Set the interrupt routine */ 491 /* Set the interrupt routine */
495 ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); 492 ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
493
496 /* Send the actual packet */ 494 /* Send the actual packet */
497 drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12); 495 hwif->output_data(drive, NULL, scsi->pc->c, 12);
496
498 if (pc->flags & PC_FLAG_DMA_OK) { 497 if (pc->flags & PC_FLAG_DMA_OK) {
499 pc->flags |= PC_FLAG_DMA_IN_PROGRESS; 498 pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
500 hwif->dma_ops->dma_start(drive); 499 hwif->dma_ops->dma_start(drive);