Adding the check only to this one place, more can be added later.
Signed-off-by: Imre Deak <imre.deak@nokia.com>
mutex_unlock(&gPVRSRVLock);
}
+static inline int pvr_is_locked(void)
+{
+ return mutex_is_locked(&gPVRSRVLock);
+}
+
static inline void pvr_init_lock(void)
{
mutex_init(&gPVRSRVLock);
readl(psDevInfo->pvRegsBaseKM + EUR_CR_CLKGATECTL));
}
-
+/* Should be called with pvr_lock held */
void HWRecoveryResetSGX(struct PVRSRV_DEVICE_NODE *psDeviceNode,
u32 ui32Component, u32 ui32CallerID)
{
PVR_UNREFERENCED_PARAMETER(ui32Component);
+ BUG_ON(!pvr_is_locked());
+
/* SGXOSTimer already has the lock as it needs to read SGX registers */
if (ui32CallerID != TIMER_ID) {
eError = PVRSRVPowerLock(ui32CallerID, IMG_FALSE);