diff options
author | sos <sos@FreeBSD.org> | 2004-10-19 20:13:38 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2004-10-19 20:13:38 +0000 |
commit | 480318fb03cb77f4966f1dcfa5429500f76874bd (patch) | |
tree | 1acbc8bb2ec48e82a3a543656d2f6244722ad264 /sys/dev/ata | |
parent | 214bd9b162a8457ac8768b7f8e9bf2de81a7e5d9 (diff) | |
download | FreeBSD-src-480318fb03cb77f4966f1dcfa5429500f76874bd.zip FreeBSD-src-480318fb03cb77f4966f1dcfa5429500f76874bd.tar.gz |
Idle the channel earlier in reinit().
Cosmetic change to suspend, dont call tsleep an extra time at exit.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/ata-all.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index d546c58..b7abbcc 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -306,6 +306,12 @@ ata_reinit(struct ata_channel *ch) } } + ch->flags &= ~ATA_IMMEDIATE_MODE; + mtx_lock(&ch->state_mtx); + ch->state = ATA_IDLE; + mtx_unlock(&ch->state_mtx); + ch->locking(ch, ATA_LF_UNLOCK); + /* attach new devices */ if ((newdev = ~devices & ch->devices)) { if ((newdev & (ATA_ATA_MASTER | ATA_ATAPI_MASTER)) && @@ -323,12 +329,6 @@ ata_reinit(struct ata_channel *ch) if (bootverbose) ata_printf(ch, -1, "device config done ..\n"); - ch->flags &= ~ATA_IMMEDIATE_MODE; - mtx_lock(&ch->state_mtx); - ch->state = ATA_IDLE; - mtx_unlock(&ch->state_mtx); - ch->locking(ch, ATA_LF_UNLOCK); - ata_start(ch); return 0; } @@ -337,19 +337,19 @@ int ata_suspend(device_t dev) { struct ata_channel *ch; - int gotit = 0; if (!dev || !(ch = device_get_softc(dev))) return ENXIO; - while (!gotit) { + while (1) { mtx_lock(&ch->state_mtx); if (ch->state == ATA_IDLE) { ch->state = ATA_ACTIVE; - gotit = 1; + mtx_unlock(&ch->state_mtx); + break; } mtx_unlock(&ch->state_mtx); - tsleep(&gotit, PRIBIO, "atasusp", hz/10); + tsleep(ch, PRIBIO, "atasusp", hz/10); } ch->locking(ch, ATA_LF_UNLOCK); return 0; |