ide-floppy: use an xfer_func_t and io_buf_t typedefs in order to unify rw

Also, move xfer_func_t typedef to the ide.h since it is used by two drivers
now (more coming).

Bart:
- use __func__ while at it

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
Borislav Petkov 2008-02-02 19:56:36 +01:00 committed by Bartlomiej Zolnierkiewicz
parent 0bf399e69c
commit 0eea6458c0
3 changed files with 19 additions and 19 deletions

View File

@ -604,8 +604,6 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
* Block read functions. * Block read functions.
*/ */
typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
static void ide_cd_pad_transfer(ide_drive_t *drive, xfer_func_t *xf, int len) static void ide_cd_pad_transfer(ide_drive_t *drive, xfer_func_t *xf, int len)
{ {
while (len > 0) { while (len > 0) {

View File

@ -516,16 +516,17 @@ static void idefloppy_retry_pc (ide_drive_t *drive)
idefloppy_queue_pc_head(drive, pc, rq); idefloppy_queue_pc_head(drive, pc, rq);
} }
/* typedef void (io_buf_t)(ide_drive_t *, idefloppy_pc_t *, unsigned int);
* idefloppy_pc_intr is the usual interrupt handler which will be 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)
{ {
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
idefloppy_pc_t *pc = floppy->pc; idefloppy_pc_t *pc = floppy->pc;
struct request *rq = pc->rq; struct request *rq = pc->rq;
xfer_func_t *xferfunc;
io_buf_t *iobuf_func;
unsigned int temp; unsigned int temp;
int dma_error = 0; int dma_error = 0;
u16 bcount; u16 bcount;
@ -592,7 +593,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
ireason = hwif->INB(IDE_IREASON_REG); ireason = hwif->INB(IDE_IREASON_REG);
if (ireason & CD) { if (ireason & CD) {
printk(KERN_ERR "ide-floppy: CoD != 0 in idefloppy_pc_intr\n"); printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __func__);
return ide_do_reset(drive); return ide_do_reset(drive);
} }
if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) { if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) {
@ -624,20 +625,18 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
} }
} }
if (test_bit(PC_WRITING, &pc->flags)) { if (test_bit(PC_WRITING, &pc->flags)) {
if (pc->buffer != NULL) xferfunc = hwif->atapi_output_bytes;
/* Write the current buffer */ iobuf_func = &idefloppy_output_buffers;
hwif->atapi_output_bytes(drive, pc->current_position,
bcount);
else
idefloppy_output_buffers(drive, pc, bcount);
} else { } else {
if (pc->buffer != NULL) xferfunc = hwif->atapi_input_bytes;
/* Read the current buffer */ iobuf_func = &idefloppy_input_buffers;
hwif->atapi_input_bytes(drive, pc->current_position,
bcount);
else
idefloppy_input_buffers(drive, pc, bcount);
} }
if (pc->buffer)
xferfunc(drive, pc->current_position, bcount);
else
iobuf_func(drive, pc, bcount);
/* Update the current position */ /* Update the current position */
pc->actually_transferred += bcount; pc->actually_transferred += bcount;
pc->current_position += bcount; pc->current_position += bcount;

View File

@ -627,6 +627,9 @@ typedef struct hwif_s {
typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
typedef int (ide_expiry_t)(ide_drive_t *); typedef int (ide_expiry_t)(ide_drive_t *);
/* used by ide-cd, ide-floppy, etc. */
typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
typedef struct hwgroup_s { typedef struct hwgroup_s {
/* irq handler, if active */ /* irq handler, if active */
ide_startstop_t (*handler)(ide_drive_t *); ide_startstop_t (*handler)(ide_drive_t *);