Skip to content

Commit 94cd5b6

Browse files
committed
ide: add ->tf_load and ->tf_read methods
* Add ->tf_load and ->tf_read methods to ide_hwif_t and set the default methods in default_hwif_transport(). * Use ->tf_{load,read} instead o calling ide_tf_{load,read}() directly. * Make ide_tf_{load,read}() static. There should be no functional changes caused by this patch. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1 parent d309e0b commit 94cd5b6

5 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎drivers/ide/ide-io.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
330330
tf->error = err;
331331
tf->status = stat;
332332

333-
ide_tf_read(drive, task);
333+
drive->hwif->tf_read(drive, task);
334334

335335
if (task->tf_flags & IDE_TFLAG_DYN)
336336
kfree(task);
@@ -1638,7 +1638,7 @@ void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma)
16381638
task.tf.lbah = (bcount >> 8) & 0xff;
16391639

16401640
ide_tf_dump(drive->name, &task.tf);
1641-
ide_tf_load(drive, &task);
1641+
drive->hwif->tf_load(drive, &task);
16421642
}
16431643

16441644
EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load);

‎drivers/ide/ide-iops.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void SELECT_MASK (ide_drive_t *drive, int mask)
127127
port_ops->maskproc(drive, mask);
128128
}
129129

130-
void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
130+
static void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
131131
{
132132
ide_hwif_t *hwif = drive->hwif;
133133
struct ide_io_ports *io_ports = &hwif->io_ports;
@@ -172,7 +172,7 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
172172
io_ports->device_addr);
173173
}
174174

175-
void ide_tf_read(ide_drive_t *drive, ide_task_t *task)
175+
static void ide_tf_read(ide_drive_t *drive, ide_task_t *task)
176176
{
177177
ide_hwif_t *hwif = drive->hwif;
178178
struct ide_io_ports *io_ports = &hwif->io_ports;
@@ -323,6 +323,9 @@ static void ata_output_data(ide_drive_t *drive, struct request *rq,
323323

324324
void default_hwif_transport(ide_hwif_t *hwif)
325325
{
326+
hwif->tf_load = ide_tf_load;
327+
hwif->tf_read = ide_tf_read;
328+
326329
hwif->input_data = ata_input_data;
327330
hwif->output_data = ata_output_data;
328331
}

‎drivers/ide/ide-lib.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ static void ide_dump_sector(ide_drive_t *drive)
487487
else
488488
task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE;
489489

490-
ide_tf_read(drive, &task);
490+
drive->hwif->tf_read(drive, &task);
491491

492492
if (lba48 || (tf->device & ATA_LBA))
493493
printk(", LBAsect=%llu",

‎drivers/ide/ide-taskfile.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
109109

110110
if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
111111
ide_tf_dump(drive->name, tf);
112-
ide_tf_load(drive, task);
112+
hwif->tf_load(drive, task);
113113
}
114114

115115
switch (task->data_phase) {

‎include/linux/ide.h‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ struct ide_dma_ops {
427427
void (*dma_timeout)(struct ide_drive_s *);
428428
};
429429

430+
struct ide_task_s;
431+
430432
typedef struct hwif_s {
431433
struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
432434
struct hwif_s *mate; /* other hwif from same PCI chip */
@@ -467,6 +469,9 @@ typedef struct hwif_s {
467469
const struct ide_port_ops *port_ops;
468470
const struct ide_dma_ops *dma_ops;
469471

472+
void (*tf_load)(ide_drive_t *, struct ide_task_s *);
473+
void (*tf_read)(ide_drive_t *, struct ide_task_s *);
474+
470475
void (*input_data)(ide_drive_t *, struct request *, void *, unsigned);
471476
void (*output_data)(ide_drive_t *, struct request *, void *, unsigned);
472477

@@ -962,9 +967,6 @@ typedef struct ide_task_s {
962967

963968
void ide_tf_dump(const char *, struct ide_taskfile *);
964969

965-
void ide_tf_load(ide_drive_t *, ide_task_t *);
966-
void ide_tf_read(ide_drive_t *, ide_task_t *);
967-
968970
extern void SELECT_DRIVE(ide_drive_t *);
969971
extern void SELECT_MASK(ide_drive_t *, int);
970972

0 commit comments

Comments
 (0)