diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:52 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:52 -0400 |
commit | b73c7ee25da6133f97f47ffd3557288417da7c76 (patch) | |
tree | 0d348c81294d246b8417aff6e24502c93b312505 /drivers/ide/ide-io.c | |
parent | c6dfa867bb45f4bff2e48f3bc89ab1d6a7ab4c21 (diff) |
ide: add ->read_status method
* Remove ide_read_status() inline helper.
* Add ->read_status method for reading ATA Status register
and use it instead of ->INB.
While at it:
* Don't use HWGROUP() macro.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index ca0c04a919cb..fdc221ce9920 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -381,8 +381,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
381 | if (err == ABRT_ERR) { | 381 | if (err == ABRT_ERR) { |
382 | if (drive->select.b.lba && | 382 | if (drive->select.b.lba && |
383 | /* some newer drives don't support WIN_SPECIFY */ | 383 | /* some newer drives don't support WIN_SPECIFY */ |
384 | hwif->INB(hwif->io_ports.command_addr) == | 384 | hwif->read_status(hwif) == WIN_SPECIFY) |
385 | WIN_SPECIFY) | ||
386 | return ide_stopped; | 385 | return ide_stopped; |
387 | } else if ((err & BAD_CRC) == BAD_CRC) { | 386 | } else if ((err & BAD_CRC) == BAD_CRC) { |
388 | /* UDMA crc error, just retry the operation */ | 387 | /* UDMA crc error, just retry the operation */ |
@@ -408,7 +407,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
408 | return ide_stopped; | 407 | return ide_stopped; |
409 | } | 408 | } |
410 | 409 | ||
411 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) | 410 | if (hwif->read_status(hwif) & (BUSY_STAT | DRQ_STAT)) |
412 | rq->errors |= ERROR_RESET; | 411 | rq->errors |= ERROR_RESET; |
413 | 412 | ||
414 | if ((rq->errors & ERROR_RESET) == ERROR_RESET) { | 413 | if ((rq->errors & ERROR_RESET) == ERROR_RESET) { |
@@ -435,7 +434,7 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u | |||
435 | /* add decoding error stuff */ | 434 | /* add decoding error stuff */ |
436 | } | 435 | } |
437 | 436 | ||
438 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) | 437 | if (hwif->read_status(hwif) & (BUSY_STAT | DRQ_STAT)) |
439 | /* force an abort */ | 438 | /* force an abort */ |
440 | hwif->exec_command(hwif, WIN_IDLEIMMEDIATE); | 439 | hwif->exec_command(hwif, WIN_IDLEIMMEDIATE); |
441 | 440 | ||
@@ -711,7 +710,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
711 | #ifdef DEBUG | 710 | #ifdef DEBUG |
712 | printk("%s: DRIVE_CMD (null)\n", drive->name); | 711 | printk("%s: DRIVE_CMD (null)\n", drive->name); |
713 | #endif | 712 | #endif |
714 | ide_end_drive_cmd(drive, ide_read_status(drive), ide_read_error(drive)); | 713 | ide_end_drive_cmd(drive, hwif->read_status(hwif), |
714 | ide_read_error(drive)); | ||
715 | 715 | ||
716 | return ide_stopped; | 716 | return ide_stopped; |
717 | } | 717 | } |
@@ -1141,7 +1141,7 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) | |||
1141 | printk(KERN_WARNING "%s: DMA timeout error\n", drive->name); | 1141 | printk(KERN_WARNING "%s: DMA timeout error\n", drive->name); |
1142 | (void)hwif->dma_ops->dma_end(drive); | 1142 | (void)hwif->dma_ops->dma_end(drive); |
1143 | ret = ide_error(drive, "dma timeout error", | 1143 | ret = ide_error(drive, "dma timeout error", |
1144 | ide_read_status(drive)); | 1144 | hwif->read_status(hwif)); |
1145 | } else { | 1145 | } else { |
1146 | printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name); | 1146 | printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name); |
1147 | hwif->dma_ops->dma_timeout(drive); | 1147 | hwif->dma_ops->dma_timeout(drive); |
@@ -1266,7 +1266,7 @@ void ide_timer_expiry (unsigned long data) | |||
1266 | } else | 1266 | } else |
1267 | startstop = | 1267 | startstop = |
1268 | ide_error(drive, "irq timeout", | 1268 | ide_error(drive, "irq timeout", |
1269 | ide_read_status(drive)); | 1269 | hwif->read_status(hwif)); |
1270 | } | 1270 | } |
1271 | drive->service_time = jiffies - drive->service_start; | 1271 | drive->service_time = jiffies - drive->service_start; |
1272 | spin_lock_irq(&ide_lock); | 1272 | spin_lock_irq(&ide_lock); |
@@ -1322,7 +1322,8 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup) | |||
1322 | */ | 1322 | */ |
1323 | do { | 1323 | do { |
1324 | if (hwif->irq == irq) { | 1324 | if (hwif->irq == irq) { |
1325 | stat = hwif->INB(hwif->io_ports.status_addr); | 1325 | stat = hwif->read_status(hwif); |
1326 | |||
1326 | if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { | 1327 | if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { |
1327 | /* Try to not flood the console with msgs */ | 1328 | /* Try to not flood the console with msgs */ |
1328 | static unsigned long last_msgtime, count; | 1329 | static unsigned long last_msgtime, count; |
@@ -1412,7 +1413,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) | |||
1412 | * Whack the status register, just in case | 1413 | * Whack the status register, just in case |
1413 | * we have a leftover pending IRQ. | 1414 | * we have a leftover pending IRQ. |
1414 | */ | 1415 | */ |
1415 | (void) hwif->INB(hwif->io_ports.status_addr); | 1416 | (void)hwif->read_status(hwif); |
1416 | #endif /* CONFIG_BLK_DEV_IDEPCI */ | 1417 | #endif /* CONFIG_BLK_DEV_IDEPCI */ |
1417 | } | 1418 | } |
1418 | spin_unlock_irqrestore(&ide_lock, flags); | 1419 | spin_unlock_irqrestore(&ide_lock, flags); |