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

Commit 22b7f24d authored by Rom Lemarchand's avatar Rom Lemarchand Committed by Greg Kroah-Hartman
Browse files

ion: add new ion_user_handle_t type for the user-space token



Declare new ion_user_handle_t type to contain the token returned to user-space.
This allows a 2-step migration of the user-space code to a new kernel header
first, then will allow us to change the definition of the ion_user_handle_type_t
to int without breaking the API.

Signed-off-by: default avatarRom Lemarchand <romlem@google.com>
(cherry picked from commit ebb8269bbb05b06ecedca3e21b3e65f23d48eadd)
[jstultz: modified patch to apply to staging directory]
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b4f8d242
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1139,7 +1139,7 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (IS_ERR(handle))
		if (IS_ERR(handle))
			return PTR_ERR(handle);
			return PTR_ERR(handle);


		data.handle = (struct ion_handle *)handle->id;
		data.handle = (ion_user_handle_t)handle->id;


		if (copy_to_user((void __user *)arg, &data, sizeof(data))) {
		if (copy_to_user((void __user *)arg, &data, sizeof(data))) {
			ion_free(client, handle);
			ion_free(client, handle);
@@ -1191,7 +1191,7 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		if (IS_ERR(handle))
		if (IS_ERR(handle))
			ret = PTR_ERR(handle);
			ret = PTR_ERR(handle);
		else
		else
			data.handle = (struct ion_handle *)handle->id;
			data.handle = (ion_user_handle_t)handle->id;


		if (copy_to_user((void __user *)arg, &data,
		if (copy_to_user((void __user *)arg, &data,
				 sizeof(struct ion_fd_data)))
				 sizeof(struct ion_fd_data)))
+5 −3
Original line number Original line Diff line number Diff line
@@ -20,6 +20,8 @@
#include <linux/types.h>
#include <linux/types.h>


struct ion_handle;
struct ion_handle;
typedef struct ion_handle *ion_user_handle_t;

/**
/**
 * enum ion_heap_types - list of all possible types of heaps
 * enum ion_heap_types - list of all possible types of heaps
 * @ION_HEAP_TYPE_SYSTEM:	 memory allocated via vmalloc
 * @ION_HEAP_TYPE_SYSTEM:	 memory allocated via vmalloc
@@ -268,7 +270,7 @@ struct ion_allocation_data {
	size_t align;
	size_t align;
	unsigned int heap_id_mask;
	unsigned int heap_id_mask;
	unsigned int flags;
	unsigned int flags;
	struct ion_handle *handle;
	ion_user_handle_t handle;
};
};


/**
/**
@@ -282,7 +284,7 @@ struct ion_allocation_data {
 * provides the file descriptor and the kernel returns the handle.
 * provides the file descriptor and the kernel returns the handle.
 */
 */
struct ion_fd_data {
struct ion_fd_data {
	struct ion_handle *handle;
	ion_user_handle_t handle;
	int fd;
	int fd;
};
};


@@ -291,7 +293,7 @@ struct ion_fd_data {
 * @handle:	a handle
 * @handle:	a handle
 */
 */
struct ion_handle_data {
struct ion_handle_data {
	struct ion_handle *handle;
	ion_user_handle_t handle;
};
};


/**
/**