gpu: pvr: BUG if pvr_lock is not held in HWRecoveryResetSGX
authorImre Deak <imre.deak@nokia.com>
Wed, 31 Mar 2010 14:08:51 +0000 (17:08 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:40 +0000 (21:09 +0300)
Adding the check only to this one place, more can be added later.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/pvr_bridge_km.h
pvr/sgxinit.c

index dfae4f4..ea3330f 100644 (file)
@@ -44,6 +44,11 @@ static inline void pvr_unlock(void)
        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);
index b945216..2efaf12 100644 (file)
@@ -636,7 +636,7 @@ static void dump_sgx_registers(struct PVRSRV_SGXDEV_INFO *psDevInfo)
                readl(psDevInfo->pvRegsBaseKM + EUR_CR_CLKGATECTL));
 }
 
-
+/* Should be called with pvr_lock held */
 void HWRecoveryResetSGX(struct PVRSRV_DEVICE_NODE *psDeviceNode,
                                u32 ui32Component, u32 ui32CallerID)
 {
@@ -649,6 +649,8 @@ void HWRecoveryResetSGX(struct PVRSRV_DEVICE_NODE *psDeviceNode,
 
        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);