From 93c5bd29c900176b8e3c38707d41fef61b5420c5 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Wed, 31 Mar 2010 17:19:22 +0300 Subject: [PATCH] gpu: pvr: fix locking in pvr_dbg_reset HWRecoverResetSGX needs to be called with the pvr_lock held. Signed-off-by: Imre Deak --- pvr/pvr_debug.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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) -- 2.39.5