video: tegra: nvmap: Add names to nvmap client
authorRebecca Schultz Zavin <rebecca@android.com>
Thu, 4 Nov 2010 21:12:37 +0000 (14:12 -0700)
committerRebecca Schultz Zavin <rebecca@android.com>
Fri, 5 Nov 2010 19:17:21 +0000 (12:17 -0700)
This modifies the api to allow the user to specify a name
for their clients.  This will allow the system to track
allocations from the kernel by name.

Change-Id: I44aad209bc54e72126be3bebfe416b30291d206c
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
arch/arm/mach-tegra/include/mach/nvmap.h
drivers/video/tegra/nvmap/nvmap.h
drivers/video/tegra/nvmap/nvmap_dev.c

index 41f06f532c392a5622706abd9383c48867952e1a..7422d1a44d8a09a8d941bf7836d1e80092882820 100644 (file)
@@ -66,7 +66,8 @@ struct nvmap_pinarray_elem {
        __u32 pin_offset;
 };
 
-struct nvmap_client *nvmap_create_client(struct nvmap_device *dev);
+struct nvmap_client *nvmap_create_client(struct nvmap_device *dev,
+                                        const char *name);
 
 struct nvmap_handle_ref *nvmap_alloc(struct nvmap_client *client, size_t size,
                                     size_t align, unsigned int flags);
index 1e5b800baf7a68e8a9207f125662bc6c80dd55f7..9bb7da77a5011fbc13f66cecb2ba2424ef69ea65 100644 (file)
@@ -100,6 +100,7 @@ struct nvmap_carveout_commit {
 };
 
 struct nvmap_client {
+       const char                      *name;
        struct nvmap_device             *dev;
        struct nvmap_share              *share;
        struct rb_root                  handle_refs;
index cbf126bafe6011ac439f5ba6121b0ddfd4112860..a899bb4ef1b9e18ccb4e70cc563d11734a7faa61 100644 (file)
@@ -427,7 +427,8 @@ struct nvmap_handle *nvmap_validate_get(struct nvmap_client *client,
        return NULL;
 }
 
-struct nvmap_client *nvmap_create_client(struct nvmap_device *dev)
+struct nvmap_client *nvmap_create_client(struct nvmap_device *dev,
+                                        const char *name)
 {
        struct nvmap_client *client;
        int i;
@@ -440,6 +441,7 @@ struct nvmap_client *nvmap_create_client(struct nvmap_device *dev)
        if (!client)
                return NULL;
 
+       client->name = name;
        client->super = true;
        client->dev = dev;
        /* TODO: allocate unique IOVMM client for each nvmap client */
@@ -554,7 +556,7 @@ static int nvmap_open(struct inode *inode, struct file *filp)
                return ret;
 
        BUG_ON(dev != nvmap_dev);
-       priv = nvmap_create_client(dev);
+       priv = nvmap_create_client(dev, "user");
        if (!priv)
                return -ENOMEM;
 
@@ -755,7 +757,8 @@ static void client_stringify(struct nvmap_client *client, struct seq_file *s)
 {
        char task_comm[sizeof(client->task->comm)];
        get_task_comm(task_comm, client->task);
-       seq_printf(s, "%16s %8u", task_comm, client->task->pid);
+       seq_printf(s, "%8s %16s %8u", client->name, task_comm,
+                  client->task->pid);
 }
 
 static void allocations_stringify(struct nvmap_client *client,