diff options
-rw-r--r-- | drivers/ide/ide-iops.c | 31 | ||||
-rw-r--r-- | drivers/ide/ppc/pmac.c | 9 | ||||
-rw-r--r-- | include/linux/ide.h | 2 |
3 files changed, 7 insertions, 35 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index fb524cf175d5..f7e976c0c2f3 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -473,35 +473,6 @@ int drive_is_ready (ide_drive_t *drive) | |||
473 | EXPORT_SYMBOL(drive_is_ready); | 473 | EXPORT_SYMBOL(drive_is_ready); |
474 | 474 | ||
475 | /* | 475 | /* |
476 | * Global for All, and taken from ide-pmac.c. Can be called | ||
477 | * with spinlock held & IRQs disabled, so don't schedule ! | ||
478 | */ | ||
479 | int wait_for_ready (ide_drive_t *drive, int timeout) | ||
480 | { | ||
481 | ide_hwif_t *hwif = HWIF(drive); | ||
482 | u8 stat = 0; | ||
483 | |||
484 | while(--timeout) { | ||
485 | stat = hwif->INB(IDE_STATUS_REG); | ||
486 | if (!(stat & BUSY_STAT)) { | ||
487 | if (drive->ready_stat == 0) | ||
488 | break; | ||
489 | else if ((stat & drive->ready_stat)||(stat & ERR_STAT)) | ||
490 | break; | ||
491 | } | ||
492 | mdelay(1); | ||
493 | } | ||
494 | if ((stat & ERR_STAT) || timeout <= 0) { | ||
495 | if (stat & ERR_STAT) { | ||
496 | printk(KERN_ERR "%s: wait_for_ready, " | ||
497 | "error status: %x\n", drive->name, stat); | ||
498 | } | ||
499 | return 1; | ||
500 | } | ||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | /* | ||
505 | * This routine busy-waits for the drive status to be not "busy". | 476 | * This routine busy-waits for the drive status to be not "busy". |
506 | * It then checks the status for all of the "good" bits and none | 477 | * It then checks the status for all of the "good" bits and none |
507 | * of the "bad" bits, and if all is okay it returns 0. All other | 478 | * of the "bad" bits, and if all is okay it returns 0. All other |
@@ -512,7 +483,7 @@ int wait_for_ready (ide_drive_t *drive, int timeout) | |||
512 | * setting a timer to wake up at half second intervals thereafter, | 483 | * setting a timer to wake up at half second intervals thereafter, |
513 | * until timeout is achieved, before timing out. | 484 | * until timeout is achieved, before timing out. |
514 | */ | 485 | */ |
515 | static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat) | 486 | int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat) |
516 | { | 487 | { |
517 | ide_hwif_t *hwif = drive->hwif; | 488 | ide_hwif_t *hwif = drive->hwif; |
518 | unsigned long flags; | 489 | unsigned long flags; |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 512452b379bd..13e26642dad7 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -541,7 +541,8 @@ static int | |||
541 | pmac_ide_do_setfeature(ide_drive_t *drive, u8 command) | 541 | pmac_ide_do_setfeature(ide_drive_t *drive, u8 command) |
542 | { | 542 | { |
543 | ide_hwif_t *hwif = HWIF(drive); | 543 | ide_hwif_t *hwif = HWIF(drive); |
544 | int result = 1; | 544 | int result; |
545 | u8 stat; | ||
545 | 546 | ||
546 | disable_irq_nosync(hwif->irq); | 547 | disable_irq_nosync(hwif->irq); |
547 | udelay(1); | 548 | udelay(1); |
@@ -552,9 +553,9 @@ pmac_ide_do_setfeature(ide_drive_t *drive, u8 command) | |||
552 | hwif->OUTB(command, IDE_NSECTOR_REG); | 553 | hwif->OUTB(command, IDE_NSECTOR_REG); |
553 | hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); | 554 | hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); |
554 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG); | 555 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG); |
555 | udelay(1); | 556 | result = __ide_wait_stat(drive, drive->ready_stat, |
556 | /* Timeout bumped for some powerbooks */ | 557 | BUSY_STAT|DRQ_STAT|ERR_STAT, |
557 | result = wait_for_ready(drive, 2000); | 558 | WAIT_CMD, &stat); |
558 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); | 559 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); |
559 | if (result) | 560 | if (result) |
560 | printk(KERN_ERR "%s: pmac_ide_do_setfeature disk not ready " | 561 | printk(KERN_ERR "%s: pmac_ide_do_setfeature disk not ready " |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 3a8cb81bb61d..d86115e9aa2c 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -1153,7 +1153,7 @@ extern void SELECT_MASK(ide_drive_t *, int); | |||
1153 | extern void QUIRK_LIST(ide_drive_t *); | 1153 | extern void QUIRK_LIST(ide_drive_t *); |
1154 | 1154 | ||
1155 | extern int drive_is_ready(ide_drive_t *); | 1155 | extern int drive_is_ready(ide_drive_t *); |
1156 | extern int wait_for_ready(ide_drive_t *, int /* timeout */); | 1156 | int __ide_wait_stat(ide_drive_t *, u8, u8, unsigned long); |
1157 | 1157 | ||
1158 | /* | 1158 | /* |
1159 | * taskfile io for disks for now...and builds request from ide_ioctl | 1159 | * taskfile io for disks for now...and builds request from ide_ioctl |