summaryrefslogtreecommitdiff
path: root/drivers/ide/ide-iops.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-11 00:39:23 +0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-11 00:39:23 +0400
commitb163f46d5ecf48d883ce156e5e5a21a1a9a125c7 (patch)
tree5ee79c2c30d959bc21607d4c45faecbdf2481c4f /drivers/ide/ide-iops.c
parentc36a7e98846a7a4a1c09b7f148395089bce512d8 (diff)
downloadlinux-b163f46d5ecf48d883ce156e5e5a21a1a9a125c7.tar.xz
ide: enhance ide_busy_sleep()
* Make ide_busy_sleep() take timeout value as a parameter and also allow use of AltStatus Register if requested with altstatus parameter. Update existing users accordingly. * Convert ide_driveid_update() and actual_try_to_identify() to use ide_busy_sleep(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r--drivers/ide/ide-iops.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 004803030f64..a940d127aae3 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -666,7 +666,7 @@ int ide_driveid_update(ide_drive_t *drive)
ide_hwif_t *hwif = drive->hwif;
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
u16 *id;
- unsigned long timeout, flags;
+ unsigned long flags;
u8 stat;
/*
@@ -678,16 +678,11 @@ int ide_driveid_update(ide_drive_t *drive)
tp_ops->set_irq(hwif, 0);
msleep(50);
tp_ops->exec_command(hwif, ATA_CMD_ID_ATA);
- timeout = jiffies + WAIT_WORSTCASE;
- do {
- if (time_after(jiffies, timeout)) {
- SELECT_MASK(drive, 0);
- return 0; /* drive timed-out */
- }
- msleep(50); /* give drive a breather */
- stat = tp_ops->read_altstatus(hwif);
- } while (stat & ATA_BUSY);
+ if (ide_busy_sleep(hwif, WAIT_WORSTCASE, 1)) {
+ SELECT_MASK(drive, 0);
+ return 0;
+ }
msleep(50); /* wait for IRQ and ATA_DRQ */
stat = tp_ops->read_status(hwif);