tegra: Add nvmap_mark_global()
Andrew Chew [Fri, 24 Aug 2012 23:25:03 +0000 (16:25 -0700)]
Add this function, to be able to set the global field of an
nvmap_handle while preserving the nvmap API's encapsulation
mechanisms.

Change-Id: I62de773a65119722f059b114e2d0e906c7e04e83
Signed-off-by: Andrew Chew <achew@nvidia.com>
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/169834
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Winnie Hsu <whsu@nvidia.com>

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

index a0dcf26..19b821d 100644 (file)
@@ -605,3 +605,16 @@ void nvmap_free(struct nvmap_client *client, struct nvmap_handle_ref *r)
 
        nvmap_free_handle_id(client, nvmap_ref_to_id(r));
 }
+
+int nvmap_mark_global(struct nvmap_client *client, struct nvmap_handle_ref *r)
+{
+       struct nvmap_handle *h;
+
+       h = nvmap_get_handle_id(client, (unsigned long)r->handle);
+       if (!h)
+               return -EINVAL;
+       r->handle->global = true;
+       nvmap_handle_put(h);
+
+       return 0;
+}
index 692956b..9cc978e 100644 (file)
@@ -124,6 +124,8 @@ void nvmap_unpin_handles(struct nvmap_client *client,
 struct nvmap_handle_ref *nvmap_duplicate_handle_id(struct nvmap_client *client,
                                                   unsigned long id);
 
+int nvmap_mark_global(struct nvmap_client *client, struct nvmap_handle_ref *r);
+
 struct nvmap_platform_carveout {
        const char *name;
        unsigned int usage_mask;