aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:56 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:56 -0400
commit374e042c3e767ac2e5a40b78529220e0b3de793c (patch)
tree433d258f6da9783f0cb34234af9c359353f531fe /drivers/ide/ide-atapi.c
parentd6276b5f5cc7508124de291f3ed59c6945c17ae7 (diff)
ide: add struct ide_tp_ops (take 2)
* Add struct ide_tp_ops for transport methods. * Add 'const struct ide_tp_ops *tp_ops' to struct ide_port_info and ide_hwif_t. * Set the default hwif->tp_ops in ide_init_port_data(). * Set host driver specific hwif->tp_ops in ide_init_port(). * Export ide_exec_command(), ide_read_status(), ide_read_altstatus(), ide_read_sff_dma_status(), ide_set_irq(), ide_tf_{load,read}() and ata_{in,out}put_data(). * Convert host drivers and core code to use struct ide_tp_ops. * Remove no longer needed default_hwif_transport(). * Cleanup ide_hwif_t from methods that are now in struct ide_tp_ops. While at it: * Use struct ide_port_info in falconide.c and q40ide.c. * Rename ata_{in,out}put_data() to ide_{in,out}put_data(). v2: * Fix missing convertion in ns87415.c. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index f17a00ccbe96..6789b81ea78d 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -22,6 +22,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
22 void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int)) 22 void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int))
23{ 23{
24 ide_hwif_t *hwif = drive->hwif; 24 ide_hwif_t *hwif = drive->hwif;
25 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
25 xfer_func_t *xferfunc; 26 xfer_func_t *xferfunc;
26 unsigned int temp; 27 unsigned int temp;
27 u16 bcount; 28 u16 bcount;
@@ -35,7 +36,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
35 } 36 }
36 37
37 /* Clear the interrupt */ 38 /* Clear the interrupt */
38 stat = hwif->read_status(hwif); 39 stat = tp_ops->read_status(hwif);
39 40
40 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { 41 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
41 if (hwif->dma_ops->dma_end(drive) || 42 if (hwif->dma_ops->dma_end(drive) ||
@@ -140,7 +141,7 @@ cmd_finished:
140 if (pc->sg) 141 if (pc->sg)
141 io_buffers(drive, pc, temp, 0); 142 io_buffers(drive, pc, temp, 0);
142 else 143 else
143 hwif->input_data(drive, NULL, 144 tp_ops->input_data(drive, NULL,
144 pc->cur_pos, temp); 145 pc->cur_pos, temp);
145 printk(KERN_ERR "%s: transferred %d of " 146 printk(KERN_ERR "%s: transferred %d of "
146 "%d bytes\n", 147 "%d bytes\n",
@@ -157,9 +158,9 @@ cmd_finished:
157 debug_log("The device wants to send us more data than " 158 debug_log("The device wants to send us more data than "
158 "expected - allowing transfer\n"); 159 "expected - allowing transfer\n");
159 } 160 }
160 xferfunc = hwif->input_data; 161 xferfunc = tp_ops->input_data;
161 } else 162 } else
162 xferfunc = hwif->output_data; 163 xferfunc = tp_ops->output_data;
163 164
164 if ((drive->media == ide_floppy && !scsi && !pc->buf) || 165 if ((drive->media == ide_floppy && !scsi && !pc->buf) ||
165 (drive->media == ide_tape && !scsi && pc->bh) || 166 (drive->media == ide_tape && !scsi && pc->bh) ||
@@ -188,7 +189,7 @@ static u8 ide_read_ireason(ide_drive_t *drive)
188 memset(&task, 0, sizeof(task)); 189 memset(&task, 0, sizeof(task));
189 task.tf_flags = IDE_TFLAG_IN_NSECT; 190 task.tf_flags = IDE_TFLAG_IN_NSECT;
190 191
191 drive->hwif->tf_read(drive, &task); 192 drive->hwif->tp_ops->tf_read(drive, &task);
192 193
193 return task.tf.nsect & 3; 194 return task.tf.nsect & 3;
194} 195}
@@ -249,7 +250,7 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
249 250
250 /* Send the actual packet */ 251 /* Send the actual packet */
251 if ((pc->flags & PC_FLAG_ZIP_DRIVE) == 0) 252 if ((pc->flags & PC_FLAG_ZIP_DRIVE) == 0)
252 hwif->output_data(drive, NULL, pc->c, 12); 253 hwif->tp_ops->output_data(drive, NULL, pc->c, 12);
253 254
254 return ide_started; 255 return ide_started;
255} 256}