summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mxc/amd-gpu/common/gsl_device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/mxc/amd-gpu/common/gsl_device.c b/drivers/mxc/amd-gpu/common/gsl_device.c
index 6fc51eb1bdc2..bcb557e69d6d 100644
--- a/drivers/mxc/amd-gpu/common/gsl_device.c
+++ b/drivers/mxc/amd-gpu/common/gsl_device.c
@@ -161,6 +161,15 @@ kgsl_device_close(gsl_device_t *device)
kgsl_log_write( KGSL_LOG_GROUP_DEVICE | KGSL_LOG_LEVEL_TRACE,
"--> int kgsl_device_close(gsl_device_t *device=0x%08x )\n", device );
+ /* make sure the device is stopped before close
+ kgsl_device_close is only called for last running caller process
+ */
+ while (device->refcnt > 0) {
+ GSL_API_MUTEX_UNLOCK();
+ kgsl_device_stop(device->id);
+ GSL_API_MUTEX_LOCK();
+ }
+
// close cmdstream
status = kgsl_cmdstream_close(device);
if( status != GSL_SUCCESS ) return status;