X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0b4e3aa066abc0728aacb4bbeb86f53f9737156e..90556fb8d47e7b68fd301dde9dbb3ae7495cf323:/iokit/Kernel/IOInterruptController.cpp?ds=inline diff --git a/iokit/Kernel/IOInterruptController.cpp b/iokit/Kernel/IOInterruptController.cpp index 3b7d49b5a..bd3baa04d 100644 --- a/iokit/Kernel/IOInterruptController.cpp +++ b/iokit/Kernel/IOInterruptController.cpp @@ -556,23 +556,26 @@ IOReturn IOSharedInterruptController::enableInterrupt(IOService *nub, long vectorNumber; IOInterruptVector *vector; OSData *vectorData; - IOInterruptState interruptState;; + IOInterruptState interruptState; interruptSources = nub->_interruptSources; vectorData = interruptSources[source].vectorData; vectorNumber = *(long *)vectorData->getBytesNoCopy(); vector = &vectors[vectorNumber]; - if (vector->interruptDisabledSoft) { - interruptState = IOSimpleLockLockDisableInterrupt(controllerLock); - vector->interruptDisabledSoft = 0; - vectorsEnabled++; + interruptState = IOSimpleLockLockDisableInterrupt(controllerLock); + if (!vector->interruptDisabledSoft) { IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState); - - if (controllerDisabled && (vectorsEnabled == vectorsRegistered)) { - controllerDisabled = 0; - provider->enableInterrupt(0); - } + return kIOReturnSuccess; + } + + vector->interruptDisabledSoft = 0; + vectorsEnabled++; + IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState); + + if (controllerDisabled && (vectorsEnabled == vectorsRegistered)) { + controllerDisabled = 0; + provider->enableInterrupt(0); } return kIOReturnSuccess; @@ -585,23 +588,23 @@ IOReturn IOSharedInterruptController::disableInterrupt(IOService *nub, long vectorNumber; IOInterruptVector *vector; OSData *vectorData; - IOInterruptState interruptState;; + IOInterruptState interruptState; interruptSources = nub->_interruptSources; vectorData = interruptSources[source].vectorData; vectorNumber = *(long *)vectorData->getBytesNoCopy(); vector = &vectors[vectorNumber]; + interruptState = IOSimpleLockLockDisableInterrupt(controllerLock); if (!vector->interruptDisabledSoft) { - interruptState = IOSimpleLockLockDisableInterrupt(controllerLock); vector->interruptDisabledSoft = 1; #if __ppc__ sync(); isync(); #endif vectorsEnabled--; - IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState); } + IOSimpleLockUnlockEnableInterrupt(controllerLock, interruptState); if (!getPlatform()->atInterruptLevel()) { while (vector->interruptActive);