Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2595f6cf authored by Shubhraprakash Das's avatar Shubhraprakash Das
Browse files

msm: kgsl: Detach process private on release



On release remove the process private pointer of the file from
the list of valid process private pointers and also free any
resources that are process ID specific. This allows for the
creation of new process private on next open from same process.

Change-Id: I08ab9cf0f37872c63df9e726d32e376ea849c2dc
CRs-Fixed: 718385
Signed-off-by: default avatarShubhraprakash Das <sadas@codeaurora.org>
parent c3b06b92
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -796,15 +796,6 @@ static void kgsl_destroy_process_private(struct kref *kref)
	struct kgsl_process_private *private = container_of(kref,
			struct kgsl_process_private, refcount);

	mutex_lock(&kgsl_driver.process_mutex);
	list_del(&private->list);
	mutex_unlock(&kgsl_driver.process_mutex);

	if (private->kobj.state_in_sysfs)
		kgsl_process_uninit_sysfs(private);
	if (private->debug_root)
		debugfs_remove_recursive(private->debug_root);

	idr_destroy(&private->mem_idr);
	idr_destroy(&private->syncsource_idr);
	kgsl_mmu_putpagetable(private->pagetable);
@@ -877,6 +868,24 @@ done:
	return private;
}

/**
 * kgsl_detach_process_private() - Remove a process private from the process
 * private list and free things in the process private that relate to
 * the process id in order to allow next open from same process create
 * a new process private
 * @private: Pointer to process private to detach
 */
static void kgsl_detach_process_private(struct kgsl_process_private *private)
{
	mutex_lock(&kgsl_driver.process_mutex);
	list_del(&private->list);
	mutex_unlock(&kgsl_driver.process_mutex);

	if (private->kobj.state_in_sysfs)
		kgsl_process_uninit_sysfs(private);
	debugfs_remove_recursive(private->debug_root);
}

/**
 * kgsl_get_process_private() - Used to find the process private structure
 * @cur_dev_priv: Current device pointer
@@ -929,6 +938,7 @@ done:

error:
	mutex_unlock(&private->process_private_mutex);
	kgsl_detach_process_private(private);
	kgsl_process_private_put(private);
	return NULL;
}
@@ -1029,6 +1039,8 @@ static int kgsl_release(struct inode *inodep, struct file *filep)

	kfree(dev_priv);

	kgsl_detach_process_private(private);

	kgsl_process_private_put(private);

	pm_runtime_put(&device->pdev->dev);