diff options
author | Krishna Reddy <vdumpa@nvidia.com> | 2012-05-22 11:19:37 -0700 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-05-24 11:25:19 -0700 |
commit | b0071ef15e639e9e4cc6d6e857cd20215f6498c8 (patch) | |
tree | 4c128180b2f171541e8472fbf8c5af3a1ddfa5a1 /include/linux | |
parent | 3a8779385b7d191287f2e6e81fcc2dbcc1188869 (diff) |
nvmap: Use linux conventions.
Avoid multiple CONFIG_TEGRA_NVMAP ifdefs.
Change-Id: Ic186a8203d8b2291d3d39ce8b612b33bee16f531
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/103937
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/nvmap.h | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/include/linux/nvmap.h b/include/linux/nvmap.h index bea59694ad27..60ccdc192df5 100644 --- a/include/linux/nvmap.h +++ b/include/linux/nvmap.h @@ -28,8 +28,8 @@ #define __user #endif -#ifndef __NVMAP_H -#define __NVMAP_H +#ifndef _LINUX_NVMAP_H +#define _LINUX_NVMAP_H #define NVMAP_HEAP_SYSMEM (1ul<<31) #define NVMAP_HEAP_IOVMM (1ul<<30) @@ -50,20 +50,31 @@ #define NVMAP_HANDLE_SECURE (0x1ul << 2) - #if defined(__KERNEL__) #if defined(CONFIG_TEGRA_NVMAP) struct nvmap_handle; struct nvmap_client; struct nvmap_device; + #define nvmap_ref_to_handle(_ref) (*(struct nvmap_handle **)(_ref)) /* Convert User space handle to Kernel. */ #define nvmap_convert_handle_u2k(h) (h) + +/* handle_ref objects are client-local references to an nvmap_handle; + * they are distinct objects so that handles can be unpinned and + * unreferenced the correct number of times when a client abnormally + * terminates */ +struct nvmap_handle_ref { + struct nvmap_handle *handle; + struct rb_node node; + atomic_t dupes; /* number of times to free on file close */ + atomic_t pin; /* number of times to unpin on free */ +}; + #elif defined(CONFIG_ION_TEGRA) /* For Ion Mem Manager support through nvmap_* API's. */ #include "../../../../../drivers/gpu/ion/ion_priv.h" - #define nvmap_client ion_client #define nvmap_device ion_device #define nvmap_handle ion_handle @@ -76,10 +87,10 @@ struct nvmap_device; BUG(); \ } \ (*((u32 *)h)); }) -#endif -#define nvmap_id_to_handle(_id) ((struct nvmap_handle *)(_id)) +#endif /* CONFIG_ION_TEGRA */ +#define nvmap_id_to_handle(_id) ((struct nvmap_handle *)(_id)) struct nvmap_pinarray_elem { __u32 patch_mem; @@ -89,19 +100,6 @@ struct nvmap_pinarray_elem { __u32 reloc_shift; }; -#if defined(CONFIG_TEGRA_NVMAP) -/* handle_ref objects are client-local references to an nvmap_handle; - * they are distinct objects so that handles can be unpinned and - * unreferenced the correct number of times when a client abnormally - * terminates */ -struct nvmap_handle_ref { - struct nvmap_handle *handle; - struct rb_node node; - atomic_t dupes; /* number of times to free on file close */ - atomic_t pin; /* number of times to unpin on free */ -}; -#endif - struct nvmap_client *nvmap_create_client(struct nvmap_device *dev, const char *name); @@ -156,6 +154,6 @@ struct nvmap_platform_data { extern struct nvmap_device *nvmap_dev; -#endif +#endif /* __KERNEL__ */ -#endif +#endif /* _LINUX_NVMAP_H */ |