Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 026cbd8d authored by Prakash Gupta's avatar Prakash Gupta
Browse files

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: default avatarPrakash Gupta <guptap@codeaurora.org>
parent 5d78c03a
Loading
Loading
Loading
Loading
+2 −33
Original line number Original line Diff line number Diff line
@@ -3,7 +3,7 @@
 * drivers/staging/android/ion/ion.c
 * drivers/staging/android/ion/ion.c
 *
 *
 * Copyright (C) 2011 Google, Inc.
 * 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
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * License version 2, as published by the Free Software Foundation, and
@@ -122,8 +122,6 @@ struct ion_handle {
	int id;
	int id;
};
};


static struct ion_device *ion_dev;

bool ion_buffer_fault_user_mappings(struct ion_buffer *buffer)
bool ion_buffer_fault_user_mappings(struct ion_buffer *buffer)
{
{
	return (buffer->flags & ION_FLAG_CACHED) &&
	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)
static int ion_debug_client_show(struct seq_file *s, void *unused)
{
{
	struct ion_client *client = s->private;
	struct ion_client *client = s->private;
	struct rb_node *n, *cnode;
	struct rb_node *n;
	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;
	}


	seq_printf(s, "%16.16s: %16.16s : %16.16s : %12.12s\n",
	seq_printf(s, "%16.16s: %16.16s : %16.16s : %12.12s\n",
			"heap_name", "size_in_bytes", "handle refcount",
			"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");
		seq_printf(s, "\n");
	}
	}
	mutex_unlock(&client->lock);
	mutex_unlock(&client->lock);
	up_write(&ion_dev->lock);
	return 0;
	return 0;
}
}


@@ -1021,7 +995,6 @@ void ion_client_destroy(struct ion_client *client)
	struct rb_node *n;
	struct rb_node *n;


	pr_debug("%s: %d\n", __func__, __LINE__);
	pr_debug("%s: %d\n", __func__, __LINE__);
	mutex_lock(&client->lock);
	while ((n = rb_first(&client->handles))) {
	while ((n = rb_first(&client->handles))) {
		struct ion_handle *handle = rb_entry(n, struct ion_handle,
		struct ion_handle *handle = rb_entry(n, struct ion_handle,
						     node);
						     node);
@@ -1029,7 +1002,6 @@ void ion_client_destroy(struct ion_client *client)
	}
	}


	idr_destroy(&client->idr);
	idr_destroy(&client->idr);
	mutex_unlock(&client->lock);


	down_write(&dev->lock);
	down_write(&dev->lock);
	if (client->task)
	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_printf(s, "%16s %16s %16s\n", "client", "pid", "size");
	seq_puts(s, "----------------------------------------------------\n");
	seq_puts(s, "----------------------------------------------------\n");


	down_read(&dev->lock);
	for (n = rb_first(&dev->clients); n; n = rb_next(n)) {
	for (n = rb_first(&dev->clients); n; n = rb_next(n)) {
		struct ion_client *client = rb_entry(n, struct ion_client,
		struct ion_client *client = rb_entry(n, struct ion_client,
						     node);
						     node);
@@ -1857,7 +1828,6 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused)
				   client->pid, size);
				   client->pid, size);
		}
		}
	}
	}
	up_read(&dev->lock);
	seq_puts(s, "----------------------------------------------------\n");
	seq_puts(s, "----------------------------------------------------\n");
	seq_puts(s, "orphaned allocations (info is from last known client):\n");
	seq_puts(s, "orphaned allocations (info is from last known client):\n");
	mutex_lock(&dev->buffer_lock);
	mutex_lock(&dev->buffer_lock);
@@ -2095,7 +2065,6 @@ debugfs_done:
	init_rwsem(&idev->lock);
	init_rwsem(&idev->lock);
	plist_head_init(&idev->heaps);
	plist_head_init(&idev->heaps);
	idev->clients = RB_ROOT;
	idev->clients = RB_ROOT;
	ion_dev = idev;
	return idev;
	return idev;
}
}
EXPORT_SYMBOL(ion_device_create);
EXPORT_SYMBOL(ion_device_create);