From 7616c0ad2087c7d244b8985390c63059a6223c45 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 18 Apr 2008 00:46:26 +0200 Subject: ide: add ide_atapi_{discard_data,write_zeros} inline helpers Add ide_atapi_{discard_data,write_zeros} inline helpers to and use them instead of home-brewn helpers in ide-{floppy,tape,scsi}. There should be no functional changes caused by this patch. Cc: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-floppy.c | 24 +++--------------------- drivers/ide/ide-tape.c | 14 ++------------ 2 files changed, 5 insertions(+), 33 deletions(-) (limited to 'drivers/ide') diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 973f5f6c815e..170c60d93f55 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -229,23 +229,6 @@ static void ide_floppy_put(struct ide_floppy_obj *floppy) mutex_unlock(&idefloppy_ref_mutex); } -/* - * Too bad. The drive wants to send us data which we are not ready to accept. - * Just throw it away. - */ -static void idefloppy_discard_data(ide_drive_t *drive, unsigned int bcount) -{ - while (bcount--) - (void) HWIF(drive)->INB(IDE_DATA_REG); -} - -static void idefloppy_write_zeros(ide_drive_t *drive, unsigned int bcount) -{ - while (bcount--) - HWIF(drive)->OUTB(0, IDE_DATA_REG); -} - - /* * Used to finish servicing a request. For read/write requests, we will call * ide_end_request to pass to the next buffer. @@ -313,10 +296,9 @@ static void ide_floppy_io_buffers(ide_drive_t *drive, idefloppy_pc_t *pc, printk(KERN_ERR "%s: leftover data in %s, bcount == %d\n", drive->name, __func__, bcount); if (direction) - idefloppy_write_zeros(drive, bcount); + ide_atapi_write_zeros(drive, bcount); else - idefloppy_discard_data(drive, bcount); - + ide_atapi_discard_data(drive, bcount); } } @@ -541,7 +523,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) printk(KERN_ERR "ide-floppy: The floppy wants " "to send us more data than expected " "- discarding data\n"); - idefloppy_discard_data(drive, bcount); + ide_atapi_discard_data(drive, bcount); ide_set_handler(drive, &idefloppy_pc_intr, diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 0598ecfd5f37..bfdc4f449797 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -518,16 +518,6 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i) return tape; } -/* - * Too bad. The drive wants to send us data which we are not ready to accept. - * Just throw it away. - */ -static void idetape_discard_data(ide_drive_t *drive, unsigned int bcount) -{ - while (bcount--) - (void) HWIF(drive)->INB(IDE_DATA_REG); -} - static void idetape_input_buffers(ide_drive_t *drive, idetape_pc_t *pc, unsigned int bcount) { @@ -538,7 +528,7 @@ static void idetape_input_buffers(ide_drive_t *drive, idetape_pc_t *pc, if (bh == NULL) { printk(KERN_ERR "ide-tape: bh == NULL in " "idetape_input_buffers\n"); - idetape_discard_data(drive, bcount); + ide_atapi_discard_data(drive, bcount); return; } count = min( @@ -1152,7 +1142,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) printk(KERN_ERR "ide-tape: The tape wants to " "send us more data than expected " "- discarding data\n"); - idetape_discard_data(drive, bcount); + ide_atapi_discard_data(drive, bcount); ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); return ide_started; -- cgit v1.2.3-59-g8ed1b