diff options
Diffstat (limited to 'drivers/gpu/pvr/services4/srvkm/env/linux/module.c')
| -rwxr-xr-x | drivers/gpu/pvr/services4/srvkm/env/linux/module.c | 25 | 
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/gpu/pvr/services4/srvkm/env/linux/module.c b/drivers/gpu/pvr/services4/srvkm/env/linux/module.c index a86de684c0a..4c9cf9e214d 100755 --- a/drivers/gpu/pvr/services4/srvkm/env/linux/module.c +++ b/drivers/gpu/pvr/services4/srvkm/env/linux/module.c @@ -476,13 +476,14 @@ PVR_MOD_STATIC void PVRSRVDriverShutdown(LDM_DEV *pDevice)  	if (!bDriverIsShutdown && !bDriverIsSuspended)  	{ +#if defined(ANDROID)  		/*  		 * Take the bridge mutex, and never release it, to stop  		 * processes trying to use the driver after it has been  		 * shutdown.  		 */  		LinuxLockMutexNested(&gPVRSRVLock, PVRSRV_LOCK_CLASS_BRIDGE); - +#endif  		(void) PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D3);  	} @@ -542,16 +543,30 @@ PVR_MOD_STATIC int PVRSRVDriverSuspend(LDM_DEV *pDevice, pm_message_t state)  	if (!bDriverIsSuspended && !bDriverIsShutdown)  	{ +#if defined(ANDROID) +		/* +		 * The bridge mutex will be held until we resume. +		 * The lock doesn't need to be taken on (non-Android) +		 * Linux systems, as all user processes will have been +		 * suspended at this point. In any case, taking the mutex +		 * may result in possible lock ordering problems being +		 * flagged up by the kernel, as the Linux console lock may +		 * have already been taken at this point. If the 3rd party +		 * display driver is Linux Framebuffer based, the previous +		 * locking order may have been bridge mutex first, followed +		 * by the console lock. +		 */  		LinuxLockMutexNested(&gPVRSRVLock, PVRSRV_LOCK_CLASS_BRIDGE); - +#endif  		if (PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D3) == PVRSRV_OK)  		{ -			/* The bridge mutex will be held until we resume */  			bDriverIsSuspended = IMG_TRUE;  		}  		else  		{ +#if defined(ANDROID)  			LinuxUnLockMutex(&gPVRSRVLock); +#endif  			res = -EINVAL;  		}  	} @@ -602,11 +617,15 @@ PVR_MOD_STATIC int PVRSRVDriverResume(LDM_DEV *pDevice)  		if (PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D0) == PVRSRV_OK)  		{  			bDriverIsSuspended = IMG_FALSE; +#if defined(ANDROID)  			LinuxUnLockMutex(&gPVRSRVLock); +#endif  		}  		else  		{ +#if defined(ANDROID)  			/* The bridge mutex is not released on failure */ +#endif  			res = -EINVAL;  		}  	}  |