ion: revert downstream fix for debugfs synchronization

revert msm specific changes conflicting with commit I3373dc1dbb5
("ion:synchronize debugfs callback and ion_client_destroy")

- revert commit I7bc7562400d ("ion: destroy ion handles under
  client->lock")
- revert commit Ic4c2f9dff90 ("ion: validate ion client in
  ion_debug_client_show() and extract data")
- revert dev->lock usage in ion_debug_heap_show.

Change-Id: Iba5f527b57f39d628b8cd833f627481cc56f6617
Signed-off-by: Prakash Gupta <guptap@codeaurora.org>
This commit is contained in:
Prakash Gupta 2017-04-28 18:48:15 +05:30
parent 5d78c03af8
commit 026cbd8d2a

View file

@ -3,7 +3,7 @@
* drivers/staging/android/ion/ion.c
*
* Copyright (C) 2011 Google, Inc.
* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@ -122,8 +122,6 @@ struct ion_handle {
int id;
};
static struct ion_device *ion_dev;
bool ion_buffer_fault_user_mappings(struct ion_buffer *buffer)
{
return (buffer->flags & ION_FLAG_CACHED) &&
@ -847,30 +845,7 @@ EXPORT_SYMBOL(ion_unmap_kernel);
static int ion_debug_client_show(struct seq_file *s, void *unused)
{
struct ion_client *client = s->private;
struct rb_node *n, *cnode;
bool found = false;
down_write(&ion_dev->lock);
if (!client || (client->dev != ion_dev)) {
up_write(&ion_dev->lock);
return -EINVAL;
}
cnode = rb_first(&ion_dev->clients);
for ( ; cnode; cnode = rb_next(cnode)) {
struct ion_client *c = rb_entry(cnode,
struct ion_client, node);
if (client == c) {
found = true;
break;
}
}
if (!found) {
up_write(&ion_dev->lock);
return -EINVAL;
}
struct rb_node *n;
seq_printf(s, "%16.16s: %16.16s : %16.16s : %12.12s\n",
"heap_name", "size_in_bytes", "handle refcount",
@ -890,7 +865,6 @@ static int ion_debug_client_show(struct seq_file *s, void *unused)
seq_printf(s, "\n");
}
mutex_unlock(&client->lock);
up_write(&ion_dev->lock);
return 0;
}
@ -1021,7 +995,6 @@ void ion_client_destroy(struct ion_client *client)
struct rb_node *n;
pr_debug("%s: %d\n", __func__, __LINE__);
mutex_lock(&client->lock);
while ((n = rb_first(&client->handles))) {
struct ion_handle *handle = rb_entry(n, struct ion_handle,
node);
@ -1029,7 +1002,6 @@ void ion_client_destroy(struct ion_client *client)
}
idr_destroy(&client->idr);
mutex_unlock(&client->lock);
down_write(&dev->lock);
if (client->task)
@ -1838,7 +1810,6 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused)
seq_printf(s, "%16s %16s %16s\n", "client", "pid", "size");
seq_puts(s, "----------------------------------------------------\n");
down_read(&dev->lock);
for (n = rb_first(&dev->clients); n; n = rb_next(n)) {
struct ion_client *client = rb_entry(n, struct ion_client,
node);
@ -1857,7 +1828,6 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused)
client->pid, size);
}
}
up_read(&dev->lock);
seq_puts(s, "----------------------------------------------------\n");
seq_puts(s, "orphaned allocations (info is from last known client):\n");
mutex_lock(&dev->buffer_lock);
@ -2095,7 +2065,6 @@ debugfs_done:
init_rwsem(&idev->lock);
plist_head_init(&idev->heaps);
idev->clients = RB_ROOT;
ion_dev = idev;
return idev;
}
EXPORT_SYMBOL(ion_device_create);