-// checkForWork() is called in a gated context
-bool IOPMPowerStateQueue::checkForWork()
-{
- PowerChangeEntry *theNode;
- uint32_t theState;
- IOService *theTarget;
- uint16_t theAction;
-
- // Dequeue and process the state change request
-#ifndef __ppc__
- IOLockLock(tmpLock);
-#endif
- if((theNode = (PowerChangeEntry *)OSDequeueAtomic((void **)&changes, 0)))
- {
-#ifndef __ppc__
- IOLockUnlock(tmpLock);
-#endif
- theState = theNode->state;
- theTarget = theNode->target;
- theAction = theNode->actionType;
- IOFree((void *)theNode, sizeof(PowerChangeEntry));
-
- switch (theAction)
- {
- case kUnIdle:
- theTarget->command_received((void *)theState, 0, 0, 0);
- break;
-
- case kPMFeatureChange:
- theTarget->messageClients(theState, theTarget);
- break;
- }
- }
-#ifndef __ppc__
- else {
- IOLockUnlock(tmpLock);
- }
-#endif
- // Return true if there's more work to be done
- if(changes) return true;
- else return false;
+ (*queueAction)(owner, entry->eventType, entry->arg0, entry->arg1);
+ IODelete(entry, PowerEventEntry, 1);
+
+ IOLockLock(queueLock);
+ }
+ IOLockUnlock(queueLock);
+
+ return false;