From: Imre Deak Date: Wed, 31 Mar 2010 14:53:20 +0000 (+0300) Subject: gpu: pvr: bail out from SGXOSTimer if it's been canceled X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cff2809a0b9ef847eebaa275334615a227a01b31;p=sgx.git gpu: pvr: bail out from SGXOSTimer if it's been canceled At the moment cancelling the timer is done in a synchronous way, so we don't need to have the extra check. But a later patch will add additional locking around the HW interrupt from where the timer can be cancelled as well. Because of lock dependency issues described in that patch we have to switch to an asynchronous way of cancelling this timer and it means we need to have the extra check. Also reset the flag indicating that the timer is cancelled when destroying it. Currently we are both cancelling and destroying the timer, but we really should just require calling the destroy function. Signed-off-by: Imre Deak --- diff --git a/pvr/sgxinit.c b/pvr/sgxinit.c index 3d09250..d00cf76 100644 --- a/pvr/sgxinit.c +++ b/pvr/sgxinit.c @@ -704,6 +704,9 @@ static void SGXOSTimer(struct work_struct *work) IMG_BOOL bPoweredDown; enum PVRSRV_ERROR eError; + if (!data->armed) + return; + psDevInfo->ui32TimeStamp++; eError = PVRSRVPowerLock(TIMER_ID, IMG_FALSE); @@ -795,6 +798,7 @@ SGXOSTimerInit(struct PVRSRV_DEVICE_NODE *psDeviceNode) void SGXOSTimerDeInit(struct timer_work_data *data) { + data->armed = false; destroy_workqueue(data->work_queue); kfree(data); } @@ -818,8 +822,8 @@ enum PVRSRV_ERROR SGXOSTimerCancel(struct timer_work_data *data) if (!data) return PVRSRV_ERROR_GENERIC; - cancel_delayed_work_sync(&data->work); data->armed = false; + cancel_delayed_work_sync(&data->work); return PVRSRV_OK; }