ide: add ->pc_{update,io}_buffers methods
Add ->pc_{update,io}_buffers methods to ide_drive_t and use
them instead of {update,io}_buffers ide_pc_intr() arguments.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index d758dcd..f46bc51 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -246,10 +246,7 @@
}
EXPORT_SYMBOL_GPL(ide_scsi_expiry);
-/* TODO: unify the code thus making some arguments go away */
-ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler,
- void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
- int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int))
+ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler)
{
struct ide_atapi_pc *pc = drive->pc;
ide_hwif_t *hwif = drive->hwif;
@@ -290,8 +287,8 @@
pc->flags |= PC_FLAG_DMA_ERROR;
} else {
pc->xferred = pc->req_xfer;
- if (update_buffers)
- update_buffers(drive, pc);
+ if (drive->pc_update_buffers)
+ drive->pc_update_buffers(drive, pc);
}
debug_log("%s: DMA finished\n", drive->name);
}
@@ -386,7 +383,8 @@
temp = 0;
if (temp) {
if (pc->sg)
- io_buffers(drive, pc, temp, 0);
+ drive->pc_io_buffers(drive, pc,
+ temp, 0);
else
tp_ops->input_data(drive, NULL,
pc->cur_pos, temp);
@@ -410,7 +408,7 @@
if ((drive->media == ide_floppy && !scsi && !pc->buf) ||
(drive->media == ide_tape && !scsi && pc->bh) ||
(scsi && pc->sg)) {
- int done = io_buffers(drive, pc, bcount,
+ int done = drive->pc_io_buffers(drive, pc, bcount,
!!(pc->flags & PC_FLAG_WRITING));
/* FIXME: don't do partial completions */
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 6e62ffa..378a22c 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -196,8 +196,7 @@
/* The usual interrupt handler called during a packet command. */
static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
{
- return ide_pc_intr(drive, idefloppy_pc_intr, idefloppy_update_buffers,
- ide_io_buffers);
+ return ide_pc_intr(drive, idefloppy_pc_intr);
}
/*
@@ -636,7 +635,9 @@
*((u16 *)&gcw) = id[ATA_ID_CONFIG];
- drive->pc_callback = ide_floppy_callback;
+ drive->pc_callback = ide_floppy_callback;
+ drive->pc_update_buffers = idefloppy_update_buffers;
+ drive->pc_io_buffers = ide_io_buffers;
if (((gcw[0] & 0x60) >> 5) == 1)
drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT;
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 72caca3..5c26e98 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -627,8 +627,7 @@
*/
static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
{
- return ide_pc_intr(drive, idetape_pc_intr, idetape_update_buffers,
- ide_tape_io_buffers);
+ return ide_pc_intr(drive, idetape_pc_intr);
}
/*
@@ -2211,7 +2210,9 @@
u8 gcw[2];
u16 *ctl = (u16 *)&tape->caps[12];
- drive->pc_callback = ide_tape_callback;
+ drive->pc_callback = ide_tape_callback;
+ drive->pc_update_buffers = idetape_update_buffers;
+ drive->pc_io_buffers = ide_tape_io_buffers;
spin_lock_init(&tape->lock);
drive->dsc_overlap = 1;