aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
authorBorislav Petkov <bbpetkov@yahoo.de>2008-02-02 13:56:36 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:36 -0500
commit0eea6458c04a1cbb2e8e5c2cdbef736d882d200c (patch)
treeb999d1360c01df8b7d4cfb0a28750f709c1c785b /drivers/ide/ide-floppy.c
parent0bf399e69c365a71c230014af90966faea92e0a3 (diff)
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>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 5ea1b1b86c4e..78afc493e1fd 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -516,16 +516,17 @@ static void idefloppy_retry_pc (ide_drive_t *drive)
516 idefloppy_queue_pc_head(drive, pc, rq); 516 idefloppy_queue_pc_head(drive, pc, rq);
517} 517}
518 518
519/* 519typedef void (io_buf_t)(ide_drive_t *, idefloppy_pc_t *, unsigned int);
520 * idefloppy_pc_intr is the usual interrupt handler which will be called 520
521 * during a packet command. 521/* The usual interrupt handler called during a packet command. */
522 */
523static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) 522static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
524{ 523{
525 idefloppy_floppy_t *floppy = drive->driver_data; 524 idefloppy_floppy_t *floppy = drive->driver_data;
526 ide_hwif_t *hwif = drive->hwif; 525 ide_hwif_t *hwif = drive->hwif;
527 idefloppy_pc_t *pc = floppy->pc; 526 idefloppy_pc_t *pc = floppy->pc;
528 struct request *rq = pc->rq; 527 struct request *rq = pc->rq;
528 xfer_func_t *xferfunc;
529 io_buf_t *iobuf_func;
529 unsigned int temp; 530 unsigned int temp;
530 int dma_error = 0; 531 int dma_error = 0;
531 u16 bcount; 532 u16 bcount;
@@ -592,7 +593,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
592 ireason = hwif->INB(IDE_IREASON_REG); 593 ireason = hwif->INB(IDE_IREASON_REG);
593 594
594 if (ireason & CD) { 595 if (ireason & CD) {
595 printk(KERN_ERR "ide-floppy: CoD != 0 in idefloppy_pc_intr\n"); 596 printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __func__);
596 return ide_do_reset(drive); 597 return ide_do_reset(drive);
597 } 598 }
598 if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) { 599 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)
624 } 625 }
625 } 626 }
626 if (test_bit(PC_WRITING, &pc->flags)) { 627 if (test_bit(PC_WRITING, &pc->flags)) {
627 if (pc->buffer != NULL) 628 xferfunc = hwif->atapi_output_bytes;
628 /* Write the current buffer */ 629 iobuf_func = &idefloppy_output_buffers;
629 hwif->atapi_output_bytes(drive, pc->current_position,
630 bcount);
631 else
632 idefloppy_output_buffers(drive, pc, bcount);
633 } else { 630 } else {
634 if (pc->buffer != NULL) 631 xferfunc = hwif->atapi_input_bytes;
635 /* Read the current buffer */ 632 iobuf_func = &idefloppy_input_buffers;
636 hwif->atapi_input_bytes(drive, pc->current_position,
637 bcount);
638 else
639 idefloppy_input_buffers(drive, pc, bcount);
640 } 633 }
634
635 if (pc->buffer)
636 xferfunc(drive, pc->current_position, bcount);
637 else
638 iobuf_func(drive, pc, bcount);
639
641 /* Update the current position */ 640 /* Update the current position */
642 pc->actually_transferred += bcount; 641 pc->actually_transferred += bcount;
643 pc->current_position += bcount; 642 pc->current_position += bcount;