msm: kgsl: Fix context reference counting

Get rid of kgsl_find_context. Use instead kgsl_context_get that does
correct RCU read locking around the itr_find and increases the
reference count on the context before returning it.  This eliminates
the chance that a context will be destroyed while somebody is still
using it.  Of course increased use of kgsl_context_get is accompanied
by kgsl_context_put in all the right places.

Change-Id: Ic0dedbad73d497fd9b451aefad8e5b28d33b829d
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
diff --git a/drivers/gpu/msm/kgsl_snapshot.c b/drivers/gpu/msm/kgsl_snapshot.c
index a5aa42f..e200294 100644
--- a/drivers/gpu/msm/kgsl_snapshot.c
+++ b/drivers/gpu/msm/kgsl_snapshot.c
@@ -139,7 +139,9 @@
 	/* Figure out how many active contexts there are - these will
 	 * be appended on the end of the structure */
 
+	rcu_read_lock();
 	idr_for_each(&device->context_idr, snapshot_context_count, &ctxtcount);
+	rcu_read_unlock();
 
 	size += ctxtcount * sizeof(struct kgsl_snapshot_linux_context);
 
@@ -187,8 +189,9 @@
 
 	/* append information for each context */
 	_ctxtptr = snapshot + sizeof(*header);
+	rcu_read_lock();
 	idr_for_each(&device->context_idr, snapshot_context_info, NULL);
-
+	rcu_read_unlock();
 	/* Return the size of the data segment */
 	return size;
 }