提交 85e39035 编写于 作者: B Bartlomiej Zolnierkiewicz

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: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
上级 6b0da28b
...@@ -246,10 +246,7 @@ int ide_scsi_expiry(ide_drive_t *drive) ...@@ -246,10 +246,7 @@ int ide_scsi_expiry(ide_drive_t *drive)
} }
EXPORT_SYMBOL_GPL(ide_scsi_expiry); 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)
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))
{ {
struct ide_atapi_pc *pc = drive->pc; struct ide_atapi_pc *pc = drive->pc;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
...@@ -290,8 +287,8 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler, ...@@ -290,8 +287,8 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler,
pc->flags |= PC_FLAG_DMA_ERROR; pc->flags |= PC_FLAG_DMA_ERROR;
} else { } else {
pc->xferred = pc->req_xfer; pc->xferred = pc->req_xfer;
if (update_buffers) if (drive->pc_update_buffers)
update_buffers(drive, pc); drive->pc_update_buffers(drive, pc);
} }
debug_log("%s: DMA finished\n", drive->name); debug_log("%s: DMA finished\n", drive->name);
} }
...@@ -386,7 +383,8 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler, ...@@ -386,7 +383,8 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler,
temp = 0; temp = 0;
if (temp) { if (temp) {
if (pc->sg) if (pc->sg)
io_buffers(drive, pc, temp, 0); drive->pc_io_buffers(drive, pc,
temp, 0);
else else
tp_ops->input_data(drive, NULL, tp_ops->input_data(drive, NULL,
pc->cur_pos, temp); pc->cur_pos, temp);
...@@ -410,7 +408,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler, ...@@ -410,7 +408,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler,
if ((drive->media == ide_floppy && !scsi && !pc->buf) || if ((drive->media == ide_floppy && !scsi && !pc->buf) ||
(drive->media == ide_tape && !scsi && pc->bh) || (drive->media == ide_tape && !scsi && pc->bh) ||
(scsi && pc->sg)) { (scsi && pc->sg)) {
int done = io_buffers(drive, pc, bcount, int done = drive->pc_io_buffers(drive, pc, bcount,
!!(pc->flags & PC_FLAG_WRITING)); !!(pc->flags & PC_FLAG_WRITING));
/* FIXME: don't do partial completions */ /* FIXME: don't do partial completions */
......
...@@ -196,8 +196,7 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) ...@@ -196,8 +196,7 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
/* The usual interrupt handler called during a packet command. */ /* The usual interrupt handler called during a packet command. */
static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
{ {
return ide_pc_intr(drive, idefloppy_pc_intr, idefloppy_update_buffers, return ide_pc_intr(drive, idefloppy_pc_intr);
ide_io_buffers);
} }
/* /*
...@@ -636,7 +635,9 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) ...@@ -636,7 +635,9 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
*((u16 *)&gcw) = id[ATA_ID_CONFIG]; *((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) if (((gcw[0] & 0x60) >> 5) == 1)
drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT; drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT;
......
...@@ -627,8 +627,7 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, ...@@ -627,8 +627,7 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
*/ */
static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
{ {
return ide_pc_intr(drive, idetape_pc_intr, idetape_update_buffers, return ide_pc_intr(drive, idetape_pc_intr);
ide_tape_io_buffers);
} }
/* /*
...@@ -2211,7 +2210,9 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) ...@@ -2211,7 +2210,9 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
u8 gcw[2]; u8 gcw[2];
u16 *ctl = (u16 *)&tape->caps[12]; 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); spin_lock_init(&tape->lock);
drive->dsc_overlap = 1; drive->dsc_overlap = 1;
......
...@@ -275,7 +275,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) ...@@ -275,7 +275,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
*/ */
static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
{ {
return ide_pc_intr(drive, idescsi_pc_intr, NULL, ide_io_buffers); return ide_pc_intr(drive, idescsi_pc_intr);
} }
static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
...@@ -407,7 +407,9 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi) ...@@ -407,7 +407,9 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
set_bit(IDESCSI_LOG_CMD, &scsi->log); set_bit(IDESCSI_LOG_CMD, &scsi->log);
#endif /* IDESCSI_DEBUG_LOG */ #endif /* IDESCSI_DEBUG_LOG */
drive->pc_callback = ide_scsi_callback; drive->pc_callback = ide_scsi_callback;
drive->pc_update_buffers = NULL;
drive->pc_io_buffers = ide_io_buffers;
ide_proc_register_driver(drive, scsi->driver); ide_proc_register_driver(drive, scsi->driver);
} }
......
...@@ -555,6 +555,10 @@ struct ide_drive_s { ...@@ -555,6 +555,10 @@ struct ide_drive_s {
/* callback for packet commands */ /* callback for packet commands */
void (*pc_callback)(struct ide_drive_s *, int); void (*pc_callback)(struct ide_drive_s *, int);
void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
unsigned int, int);
unsigned long atapi_flags; unsigned long atapi_flags;
struct ide_atapi_pc request_sense_pc; struct ide_atapi_pc request_sense_pc;
...@@ -1184,10 +1188,7 @@ static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc) ...@@ -1184,10 +1188,7 @@ static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc)
int ide_scsi_expiry(ide_drive_t *); int ide_scsi_expiry(ide_drive_t *);
ide_startstop_t ide_pc_intr(ide_drive_t *drive, ide_handler_t *handler, 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,
int));
ide_startstop_t ide_transfer_pc(ide_drive_t *, ide_startstop_t ide_transfer_pc(ide_drive_t *,
ide_handler_t *, unsigned int, ide_expiry_t *); ide_handler_t *, unsigned int, ide_expiry_t *);
ide_startstop_t ide_issue_pc(ide_drive_t *, ide_startstop_t ide_issue_pc(ide_drive_t *,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册