From: Imre Deak Date: Wed, 31 Mar 2010 14:08:51 +0000 (+0300) Subject: gpu: pvr: BUG if pvr_lock is not held in HWRecoveryResetSGX X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cac72cf0a4ebbf53f8577edff5e4919314d0904;p=sgx.git gpu: pvr: BUG if pvr_lock is not held in HWRecoveryResetSGX Adding the check only to this one place, more can be added later. Signed-off-by: Imre Deak --- diff --git a/pvr/pvr_bridge_km.h b/pvr/pvr_bridge_km.h index dfae4f4..ea3330f 100644 --- a/pvr/pvr_bridge_km.h +++ b/pvr/pvr_bridge_km.h @@ -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); diff --git a/pvr/sgxinit.c b/pvr/sgxinit.c index b945216..2efaf12 100644 --- a/pvr/sgxinit.c +++ b/pvr/sgxinit.c @@ -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);