Idle the channel earlier in reinit().
Cosmetic change to suspend, dont call tsleep an extra time at exit.
This commit is contained in:
parent
53f19be8fd
commit
61efd2a8b3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=136707
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user