[patch] ide: merge PIO write/multiwrite code (ide-disk.c)
Merge multwrite_intr() into write_intr().
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
---
linux-2.6.9-rc1-bk16-bzolnier/drivers/ide/ide-disk.c | 40 ++-----------------
1 files changed, 6 insertions(+), 34 deletions(-)
diff -puN drivers/ide/ide-disk.c~ide_multwrite drivers/ide/ide-disk.c
--- linux-2.6.9-rc1-bk16/drivers/ide/ide-disk.c~ide_multwrite 2004-09-10 23:50:32.208780440 +0200
+++ linux-2.6.9-rc1-bk16-bzolnier/drivers/ide/ide-disk.c 2004-09-10 23:50:32.211779984 +0200
@@ -155,7 +155,7 @@ static ide_startstop_t read_intr (ide_dr
}
/*
- * write_intr() is the handler for disk write interrupts
+ * write_intr() is the handler for disk write/multwrite interrupts
*/
static ide_startstop_t write_intr (ide_drive_t *drive)
{
@@ -175,7 +175,10 @@ static ide_startstop_t write_intr (ide_d
ide_end_request(drive, 1, hwif->nsect);
return ide_stopped;
}
- ide_pio_sector(drive, 1);
+ if (drive->mult_count)
+ ide_pio_multi(drive, 1);
+ else
+ ide_pio_sector(drive, 1);
ide_set_handler(drive, &write_intr, WAIT_CMD, NULL);
return ide_started;
}
@@ -186,36 +189,6 @@ static ide_startstop_t write_intr (ide_d
}
/*
- * multwrite_intr() is the handler for disk multwrite interrupts
- */
-static ide_startstop_t multwrite_intr (ide_drive_t *drive)
-{
- ide_hwif_t *hwif = HWIF(drive);
- struct request *rq = hwif->hwgroup->rq;
- u8 stat;
-
- stat = hwif->INB(IDE_STATUS_REG);
- if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) {
- if (stat & DRQ_STAT) {
- /* The drive wants data. */
- if (hwif->nleft) {
- ide_pio_multi(drive, 1);
- ide_set_handler(drive, &multwrite_intr, WAIT_CMD, NULL);
- return ide_started;
- }
- } else {
- if (!hwif->nleft) { /* all done? */
- ide_end_request(drive, 1, hwif->nsect);
- return ide_stopped;
- }
- }
- /* the original code did this here (?) */
- return ide_stopped;
- }
- return task_error(drive, rq, __FUNCTION__, stat);
-}
-
-/*
* __ide_do_rw_disk() issues READ and WRITE commands to a disk,
* using LBA if supported, or CHS otherwise, to address sectors.
* It also takes care of issuing special DRIVE_CMDs.
@@ -350,11 +323,10 @@ ide_startstop_t __ide_do_rw_disk (ide_dr
}
if (!drive->unmask)
local_irq_disable();
+ ide_set_handler(drive, &write_intr, WAIT_CMD, NULL);
if (drive->mult_count) {
- ide_set_handler(drive, &multwrite_intr, WAIT_CMD, NULL);
ide_pio_multi(drive, 1);
} else {
- ide_set_handler(drive, &write_intr, WAIT_CMD, NULL);
ide_pio_sector(drive, 1);
}
return ide_started;
_