From c0645e1f9588b135862510da040e0c5d2fb00f5b Mon Sep 17 00:00:00 2001 From: Rebecca Schultz Zavin Date: Thu, 4 Nov 2010 14:12:37 -0700 Subject: [PATCH] video: tegra: nvmap: Add names to nvmap client 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 --- arch/arm/mach-tegra/include/mach/nvmap.h | 3 ++- drivers/video/tegra/nvmap/nvmap.h | 1 + drivers/video/tegra/nvmap/nvmap_dev.c | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-tegra/include/mach/nvmap.h b/arch/arm/mach-tegra/include/mach/nvmap.h index 41f06f532c39..7422d1a44d8a 100644 --- a/arch/arm/mach-tegra/include/mach/nvmap.h +++ b/arch/arm/mach-tegra/include/mach/nvmap.h @@ -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); diff --git a/drivers/video/tegra/nvmap/nvmap.h b/drivers/video/tegra/nvmap/nvmap.h index 1e5b800baf7a..9bb7da77a501 100644 --- a/drivers/video/tegra/nvmap/nvmap.h +++ b/drivers/video/tegra/nvmap/nvmap.h @@ -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; diff --git a/drivers/video/tegra/nvmap/nvmap_dev.c b/drivers/video/tegra/nvmap/nvmap_dev.c index cbf126bafe60..a899bb4ef1b9 100644 --- a/drivers/video/tegra/nvmap/nvmap_dev.c +++ b/drivers/video/tegra/nvmap/nvmap_dev.c @@ -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, -- 2.34.1