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

Commit bd1829c4 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

ion: msm: update custom caching ioctls for new handle format



The userspace API for Ion handles has changed slightly. Update the MSM
caching ioctls to work with the new format.

Change-Id: I6dee3190f5cad117a4d7059f1c7f0f01e05692c0
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent b50f4ed5
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -805,7 +805,14 @@ static long msm_ion_custom_ioctl(struct ion_client *client,
					sizeof(struct ion_flush_data)))
			return -EFAULT;

		if (!data.handle) {
		if (data.handle >= 0) {
			handle = ion_handle_get_by_id(client, (int)data.handle);
			if (IS_ERR(handle)) {
				pr_info("%s: Could not find handle: %d\n",
					__func__, (int)data.handle);
				return PTR_ERR(handle);
			}
		} else {
			handle = ion_import_dma_buf(client, data.fd);
			if (IS_ERR(handle)) {
				pr_info("%s: Could not import handle: %p\n",
@@ -820,28 +827,20 @@ static long msm_ion_custom_ioctl(struct ion_client *client,
		end = (unsigned long) data.vaddr + data.length;

		if (start && check_vaddr_bounds(start, end)) {
			up_read(&mm->mmap_sem);
			pr_err("%s: virtual address %p is out of bounds\n",
				__func__, data.vaddr);
			if (!data.handle)
				ion_free(client, handle);
			return -EINVAL;
			ret = -EINVAL;
		} else {
			ret = ion_do_cache_op(client, handle, data.vaddr,
					data.offset, data.length, cmd);
		}

		ret = ion_do_cache_op(client,
				data.handle ? data.handle : handle,
				data.vaddr, data.offset, data.length,
				cmd);

		up_read(&mm->mmap_sem);

		if (!data.handle)
		ion_free(client, handle);

		if (ret < 0)
			return ret;
		break;

	}
	case ION_IOC_PREFETCH:
	{