From: Imre Deak Date: Wed, 31 Mar 2010 14:19:22 +0000 (+0300) Subject: gpu: pvr: fix locking in pvr_dbg_reset X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93c5bd29c900176b8e3c38707d41fef61b5420c5;p=sgx.git gpu: pvr: fix locking in pvr_dbg_reset HWRecoverResetSGX needs to be called with the pvr_lock held. Signed-off-by: Imre Deak --- diff --git a/pvr/pvr_debug.c b/pvr/pvr_debug.c index 5dff963..b3a05a2 100644 --- a/pvr/pvr_debug.c +++ b/pvr/pvr_debug.c @@ -40,6 +40,7 @@ #include "syscommon.h" #include "sgxinfokm.h" #include "sgxutils.h" +#include "pvr_bridge_km.h" u32 gPVRDebugLevel = DBGPRIV_WARNING; @@ -274,19 +275,26 @@ static int pvr_dbg_reset(void *data, u64 val) { struct PVRSRV_DEVICE_NODE *node; enum PVRSRV_ERROR err; + int r = 0; if (val != 1) return 0; + pvr_lock(); + node = get_sgx_node(); - if (!node) - return -ENODEV; + if (!node) { + r = -ENODEV; + goto exit; + } err = PVRSRVSetDevicePowerStateKM(node->sDevId.ui32DeviceIndex, PVRSRV_POWER_STATE_D0, KERNEL_ID, IMG_TRUE); - if (err != PVRSRV_OK) - return -EIO; + if (err != PVRSRV_OK) { + r = -EIO; + goto exit; + } /* * Yes, this is kinda braindead. KERNEL_ID, IMG_TRUE above means @@ -299,8 +307,10 @@ static int pvr_dbg_reset(void *data, u64 val) HWRecoveryResetSGX(node, 0, TIMER_ID); SGXTestActivePowerEvent(node, KERNEL_ID); +exit: + pvr_unlock(); - return 0; + return r; } static int pvr_dbg_set(void *data, u64 val)