video: tegra: nvmap: move client used api to linux/nvmap.h
Krishna Reddy [Thu, 21 Feb 2013 19:23:59 +0000 (11:23 -0800)]
Prepare for marshal/unmarshal of nvmap handles.
Bug 1228120

Change-Id: Ie0f8c6aba0c39d912068f99191a1272ebfcd52e7
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/203022
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>

drivers/video/tegra/nvmap/nvmap.c
drivers/video/tegra/nvmap/nvmap.h
include/linux/nvmap.h

index 04fca9c..19bc955 100644 (file)
@@ -899,3 +899,14 @@ void nvmap_free(struct nvmap_client *client, struct nvmap_handle_ref *r)
 
        nvmap_free_handle_id(client, nvmap_ref_to_id(r));
 }
+
+void nvmap_handle_put(struct nvmap_handle *h)
+{
+       int cnt = atomic_dec_return(&h->ref);
+
+       if (WARN_ON(cnt < 0)) {
+               pr_err("%s: %s put to negative references\n",
+                       __func__, current->comm);
+       } else if (cnt == 0)
+               _nvmap_handle_free(h);
+}
index c78de1f..e9c37fb 100644 (file)
@@ -202,17 +202,6 @@ static inline struct nvmap_handle *nvmap_handle_get(struct nvmap_handle *h)
        return h;
 }
 
-static inline void nvmap_handle_put(struct nvmap_handle *h)
-{
-       int cnt = atomic_dec_return(&h->ref);
-
-       if (WARN_ON(cnt < 0)) {
-               pr_err("%s: %s put to negative references\n",
-                       __func__, current->comm);
-       } else if (cnt == 0)
-               _nvmap_handle_free(h);
-}
-
 static inline pgprot_t nvmap_pgprot(struct nvmap_handle *h, pgprot_t prot)
 {
        if (h->flags == NVMAP_HANDLE_UNCACHEABLE)
@@ -263,7 +252,6 @@ void nvmap_carveout_commit_subtract(struct nvmap_client *client,
 
 struct nvmap_share *nvmap_get_share_from_dev(struct nvmap_device *dev);
 
-
 void nvmap_cache_maint_ops_flush(struct nvmap_device *dev,
                struct nvmap_handle *h);
 
@@ -279,9 +267,6 @@ struct nvmap_handle *nvmap_validate_get(struct nvmap_client *client,
 struct nvmap_handle_ref *_nvmap_validate_id_locked(struct nvmap_client *priv,
                                                   unsigned long id);
 
-struct nvmap_handle *nvmap_get_handle_id(struct nvmap_client *client,
-                                        unsigned long id);
-
 struct nvmap_handle_ref *nvmap_create_handle(struct nvmap_client *client,
                                             size_t size);
 
@@ -306,9 +291,4 @@ void nvmap_handle_add(struct nvmap_device *dev, struct nvmap_handle *h);
 
 int is_nvmap_vma(struct vm_area_struct *vma);
 
-struct nvmap_handle_ref *nvmap_alloc_iovm(struct nvmap_client *client,
-       size_t size, size_t align, unsigned int flags, unsigned int iova_start);
-
-void nvmap_free_iovm(struct nvmap_client *client, struct nvmap_handle_ref *r);
-
 #endif /* __VIDEO_TEGRA_NVMAP_NVMAP_H */
index 1c9aa18..c5c41be 100644 (file)
@@ -151,6 +151,16 @@ int nvmap_pin_array(struct nvmap_client *client,
 struct nvmap_handle_ref *nvmap_duplicate_handle_id(struct nvmap_client *client,
                                                   unsigned long id);
 
+struct nvmap_handle *nvmap_get_handle_id(struct nvmap_client *client,
+                                        unsigned long id);
+
+void nvmap_handle_put(struct nvmap_handle *h);
+
+struct nvmap_handle_ref *nvmap_alloc_iovm(struct nvmap_client *client,
+       size_t size, size_t align, unsigned int flags, unsigned int iova_start);
+
+void nvmap_free_iovm(struct nvmap_client *client, struct nvmap_handle_ref *r);
+
 struct nvmap_platform_carveout {
        const char *name;
        unsigned int usage_mask;