- if (priv->head_note_pendingAcks != 0 ) { // yes, make sure we're expecting acks
- if ( ackingObject != NULL ) { // it's an interested driver
- if ( ackingObject->timer != 0 ) { // make sure we're expecting this ack
- ackingObject->timer = 0; // mark it acked
- priv->head_note_pendingAcks -= 1; // that's one fewer to worry about
- if ( priv->head_note_pendingAcks == 0 ) { // is that the last?
- stop_ack_timer(); // yes, stop the timer
- IOUnlock(priv->our_lock);
- all_acked(); // and now we can continue
- return IOPMNoErr;
- }
- }
- else {
- pm_vars->thePlatform->PMLog(pm_vars->ourName,PMlogAcknowledgeErr2,0,0); // this driver has already acked
- kprintf("errant driver: %s\n",whichObject->getName());
- }
- }
- else { // it's a child
- if ( ((IOPowerConnection *)whichObject)->getAwaitingAck() ) { // make sure we're expecting this ack
- priv->head_note_pendingAcks -= 1; // that's one fewer to worry about
+ // one of our interested drivers?
+ ackingObject = priv->interestedDrivers->findItem(whichObject);
+ if ( ackingObject == NULL )
+ {
+ if ( ! isChild(whichObject,gIOPowerPlane) )
+ {
+ pm_vars->thePlatform->PMLog(pm_vars->ourName,PMlogAcknowledgeErr1,0,0);
+ //kprintf("errant driver: %s\n",whichObject->getName());
+ // no, just return
+ return IOPMNoErr;
+ } else {
+ pm_vars->thePlatform->PMLog(pm_vars->ourName,PMlogChildAcknowledge,priv->head_note_pendingAcks,0);
+ }
+ } else {
+ pm_vars->thePlatform->PMLog(pm_vars->ourName,PMlogDriverAcknowledge,priv->head_note_pendingAcks,0);
+ }
+
+ if (! acquire_lock() )
+ {
+ return IOPMNoErr;
+ }
+
+ if (priv->head_note_pendingAcks != 0 )
+ {
+ // yes, make sure we're expecting acks
+ if ( ackingObject != NULL )
+ {
+ // it's an interested driver
+ // make sure we're expecting this ack
+ if ( ackingObject->timer != 0 )
+ {
+ // mark it acked
+ ackingObject->timer = 0;
+ // that's one fewer to worry about
+ OSAddAtomic(-1, (SInt32*)&priv->head_note_pendingAcks);
+ // is that the last?
+ if ( priv->head_note_pendingAcks == 0 )
+ {
+ // yes, stop the timer
+ stop_ack_timer();
+ IOUnlock(priv->our_lock);
+ // and now we can continue
+ all_acked();
+ return IOPMNoErr;
+ }
+ } else {
+ // this driver has already acked
+ pm_vars->thePlatform->PMLog(pm_vars->ourName,PMlogAcknowledgeErr2,0,0);
+ //kprintf("errant driver: %s\n",whichObject->getName());
+ }
+ } else {
+ // it's a child
+ // make sure we're expecting this ack
+ if ( ((IOPowerConnection *)whichObject)->getAwaitingAck() )
+ {
+ // that's one fewer to worry about
+ OSAddAtomic(-1, (SInt32*)&priv->head_note_pendingAcks);