From: Laura Abbott Date: Mon, 17 Feb 2014 21:58:35 +0000 (-0800) Subject: staging: ion: Fix debugfs handling of multiple kernel clients X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=483ed03f5eee1d1207e8648e923d615ce0599814;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git staging: ion: Fix debugfs handling of multiple kernel clients Currently, Ion registers all debugfs entries for clients via pid. If there are multiple kernel clients, this means the debugfs entry only gets created for the first one. Fix this by creating debugfs entries by name always. When creating user clients, specify the name via the pid. Cc: Colin Cross Cc: Android Kernel Team Signed-off-by: Laura Abbott Signed-off-by: Mitchel Humpherys [jstultz: Minor commit subject tweaks] Signed-off-by: John Stultz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 8f6bdb7dbf62..486942071f01 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -719,7 +719,6 @@ struct ion_client *ion_client_create(struct ion_device *dev, struct rb_node **p; struct rb_node *parent = NULL; struct ion_client *entry; - char debug_name[64]; pid_t pid; get_task_struct(current->group_leader); @@ -764,15 +763,14 @@ struct ion_client *ion_client_create(struct ion_device *dev, rb_link_node(&client->node, parent, p); rb_insert_color(&client->node, &dev->clients); - snprintf(debug_name, 64, "%u", client->pid); - client->debug_root = debugfs_create_file(debug_name, 0664, + client->debug_root = debugfs_create_file(name, 0664, dev->clients_debug_root, client, &debug_client_fops); if (!client->debug_root) { char buf[256], *path; path = dentry_path(dev->clients_debug_root, buf, 256); pr_err("Failed to create client debugfs at %s/%s\n", - path, debug_name); + path, name); } up_write(&dev->lock); @@ -1301,9 +1299,11 @@ static int ion_open(struct inode *inode, struct file *file) struct miscdevice *miscdev = file->private_data; struct ion_device *dev = container_of(miscdev, struct ion_device, dev); struct ion_client *client; + char debug_name[64]; pr_debug("%s: %d\n", __func__, __LINE__); - client = ion_client_create(dev, "user"); + snprintf(debug_name, 64, "%u", task_pid_nr(current->group_leader)); + client = ion_client_create(dev, debug_name); if (IS_ERR(client)) return PTR_ERR(client); file->private_data = client;