summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/video/tegra/nvmap/nvmap.c13
-rw-r--r--drivers/video/tegra/nvmap/nvmap_ioctl.c30
-rw-r--r--drivers/video/tegra/nvmap/nvmap_priv.h4
-rw-r--r--include/trace/events/nvmap.h10
4 files changed, 23 insertions, 34 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap.c b/drivers/video/tegra/nvmap/nvmap.c
index ec9718fa1ada..ea90abc0ea95 100644
--- a/drivers/video/tegra/nvmap/nvmap.c
+++ b/drivers/video/tegra/nvmap/nvmap.c
@@ -107,7 +107,7 @@ done:
}
int nvmap_pin_ids(struct nvmap_client *client, unsigned int nr,
- const unsigned long *ids)
+ struct nvmap_handle * const *ids)
{
int i, err = 0;
phys_addr_t phys;
@@ -121,8 +121,7 @@ int nvmap_pin_ids(struct nvmap_client *client, unsigned int nr,
if (!ids[i] || !virt_addr_valid(ids[i]))
continue;
- ref = __nvmap_validate_locked(client,
- (struct nvmap_handle *)ids[i]);
+ ref = __nvmap_validate_locked(client, ids[i]);
if (!ref) {
err = -EPERM;
goto err_cleanup;
@@ -148,8 +147,7 @@ err_cleanup:
* We will get the ref again - the ref lock has yet to be given
* up so if this worked the first time it will work again.
*/
- ref = __nvmap_validate_locked(client,
- (struct nvmap_handle *)ids[i]);
+ ref = __nvmap_validate_locked(client, ids[i]);
__nvmap_unpin(ref);
}
nvmap_ref_unlock(client);
@@ -161,7 +159,7 @@ err_cleanup:
* will still be unpinned.
*/
void nvmap_unpin_ids(struct nvmap_client *client, unsigned int nr,
- const unsigned long *ids)
+ struct nvmap_handle * const *ids)
{
int i;
struct nvmap_handle_ref *ref;
@@ -171,8 +169,7 @@ void nvmap_unpin_ids(struct nvmap_client *client, unsigned int nr,
if (!ids[i] || !virt_addr_valid(ids[i]))
continue;
- ref = __nvmap_validate_locked(client,
- (struct nvmap_handle *)ids[i]);
+ ref = __nvmap_validate_locked(client, ids[i]);
if (!ref) {
pr_info("ref is null during unpin.\n");
continue;
diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.c b/drivers/video/tegra/nvmap/nvmap_ioctl.c
index 915920bbcbdb..86418b645f0d 100644
--- a/drivers/video/tegra/nvmap/nvmap_ioctl.c
+++ b/drivers/video/tegra/nvmap/nvmap_ioctl.c
@@ -62,15 +62,9 @@ ulong unmarshal_user_handle(__u32 handle)
return fd_to_handle_id((int)handle);
}
-ulong unmarshal_user_handle_array(__u32 handles, __u32 idx)
+static struct nvmap_handle *unmarshal_user_handle_array_single(__u32 handles)
{
- __u32 *ptr = (__u32 *)((uintptr_t)handles);
- return unmarshal_user_handle(ptr[idx]);
-}
-
-ulong unmarshal_user_handle_array_single(__u32 handles)
-{
- return unmarshal_user_handle((ulong)handles);
+ return (struct nvmap_handle *)unmarshal_user_handle((ulong)handles);
}
struct nvmap_handle *unmarshal_user_id(u32 id)
@@ -108,14 +102,11 @@ ulong unmarshal_user_handle(struct nvmap_handle *handle)
return fd_to_handle_id((int)handle);
}
-ulong unmarshal_user_handle_array(struct nvmap_handle **handles, __u32 idx)
+static struct nvmap_handle *unmarshal_user_handle_array_single(
+ struct nvmap_handle **handles)
{
- return unmarshal_user_handle(handles[idx]);
-}
-
-ulong unmarshal_user_handle_array_single(struct nvmap_handle **handles)
-{
- return unmarshal_user_handle((struct nvmap_handle *)handles);
+ return (struct nvmap_handle *)unmarshal_user_handle(
+ (struct nvmap_handle *)handles);
}
struct nvmap_handle *unmarshal_user_id(ulong id)
@@ -151,8 +142,8 @@ int nvmap_ioctl_pinop(struct file *filp, bool is_pin, void __user *arg)
{
struct nvmap_pin_handle op;
struct nvmap_handle *h;
- unsigned long on_stack[16];
- unsigned long *refs;
+ struct nvmap_handle *on_stack[16];
+ struct nvmap_handle **refs;
#ifdef CONFIG_COMPAT
u32 __user *output;
#else
@@ -195,7 +186,8 @@ int nvmap_ioctl_pinop(struct file *filp, bool is_pin, void __user *arg)
err = -EFAULT;
goto out;
}
- refs[i] = unmarshal_user_handle(handle);
+ refs[i] = (struct nvmap_handle *)unmarshal_user_handle(
+ handle);
if (!refs[i]) {
err = -EINVAL;
goto out;
@@ -236,7 +228,7 @@ int nvmap_ioctl_pinop(struct file *filp, bool is_pin, void __user *arg)
for (i = 0; i < op.count && !err; i++) {
unsigned long addr;
- h = (struct nvmap_handle *)refs[i];
+ h = refs[i];
if (h->heap_pgalloc && h->pgalloc.contig)
addr = page_to_phys(h->pgalloc.pages[0]);
else if (h->heap_pgalloc)
diff --git a/drivers/video/tegra/nvmap/nvmap_priv.h b/drivers/video/tegra/nvmap/nvmap_priv.h
index c345775a6127..d22820b2f027 100644
--- a/drivers/video/tegra/nvmap/nvmap_priv.h
+++ b/drivers/video/tegra/nvmap/nvmap_priv.h
@@ -365,10 +365,10 @@ void nvmap_free_handle(struct nvmap_client *c, struct nvmap_handle *h);
void nvmap_free_handle_user_id(struct nvmap_client *c, unsigned long user_id);
int nvmap_pin_ids(struct nvmap_client *client,
- unsigned int nr, const unsigned long *ids);
+ unsigned int nr, struct nvmap_handle * const *ids);
void nvmap_unpin_ids(struct nvmap_client *priv,
- unsigned int nr, const unsigned long *ids);
+ unsigned int nr, struct nvmap_handle * const *ids);
int nvmap_handle_remove(struct nvmap_device *dev, struct nvmap_handle *h);
diff --git a/include/trace/events/nvmap.h b/include/trace/events/nvmap.h
index 49e9202d0457..671aed193034 100644
--- a/include/trace/events/nvmap.h
+++ b/include/trace/events/nvmap.h
@@ -315,7 +315,7 @@ TRACE_EVENT(nvmap_ioctl_pinop,
TP_PROTO(struct nvmap_client *client,
u32 is_pin,
u32 count,
- unsigned long *ids
+ struct nvmap_handle **ids
),
TP_ARGS(client, is_pin, count, ids),
@@ -324,8 +324,8 @@ TRACE_EVENT(nvmap_ioctl_pinop,
__field(struct nvmap_client *, client)
__field(u32, is_pin)
__field(u32, count)
- __field(unsigned long *, ids)
- __dynamic_array(unsigned long, ids, count)
+ __field(struct nvmap_handle **, ids)
+ __dynamic_array(struct nvmap_handle *, ids, count)
),
TP_fast_assign(
@@ -334,13 +334,13 @@ TRACE_EVENT(nvmap_ioctl_pinop,
__entry->count = count;
__entry->ids = ids;
memcpy(__get_dynamic_array(ids), ids,
- sizeof(unsigned long) * count);
+ sizeof(struct nvmap_handle *) * count);
),
TP_printk("client=%p, is_pin=%d, count=%d, ids=[%s]",
__entry->client, __entry->is_pin, __entry->count,
__print_hex(__get_dynamic_array(ids), __entry->ids ?
- sizeof(unsigned long) * __entry->count : 0))
+ sizeof(struct nvmap_handle *) * __entry->count : 0))
);
DECLARE_EVENT_CLASS(pin_unpin,