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

Commit 4550ab8d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Detach process private on release"

parents b7362469 2595f6cf
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);