public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: andriod: ion: Add ion_phys_get_by_id function
@ 2015-01-04  7:11 Feng Tang
  2015-01-04  7:11 ` [PATCH 2/2] staging: android: ion: Add pss info for each ion_client Feng Tang
  2015-01-05 14:24 ` [PATCH 1/2] staging: andriod: ion: Add ion_phys_get_by_id function One Thousand Gnomes
  0 siblings, 2 replies; 7+ messages in thread
From: Feng Tang @ 2015-01-04  7:11 UTC (permalink / raw)
  To: Greg KH, John Stultz
  Cc: Colin Cross, Heesub Shin, Mitchel Humpherys, linux-kernel,
	Feng Tang

There is user case that user only knows the ion_handle idand
needs to get the physical addr and len. So add this wrapper to
meet this requirement.

Signed-off-by: Feng Tang <feng.tang@intel.com>
---
 drivers/staging/android/ion/ion.c |   16 ++++++++++++++++
 drivers/staging/android/ion/ion.h |   14 ++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 296d347..3d378ef 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -577,6 +577,22 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
 }
 EXPORT_SYMBOL(ion_phys);
 
+int ion_phys_get_by_id(struct ion_client *client, int id,
+	     ion_phys_addr_t *addr, size_t *len)
+{
+	struct ion_handle *handle;
+	int ret;
+
+	handle = ion_handle_get_by_id(client, id);
+	if (!handle)
+		return -EINVAL;
+
+	ret = ion_phys(client, handle, addr, len);
+	ion_handle_put(handle);
+	return ret;
+}
+EXPORT_SYMBOL(ion_phys_get_by_id);
+
 static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
 {
 	void *vaddr;
diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h
index 443db84..9ef0f18 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -147,6 +147,20 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
 	     ion_phys_addr_t *addr, size_t *len);
 
 /**
+ * ion_phys_get_by_id - returns the physical address and len of a handle
+ * @client:	the client
+ * @id:		id bound to ion_handle, which may be passed to user space
+ * @addr:	a pointer to put the address in
+ * @len:	a pointer to put the length in
+ *
+ * This function will first get ion_handle from the id, and then
+ * use upper ion_phys() to get the physical and len.
+ */
+
+int ion_phys_get_by_id(struct ion_client *client, int id,
+	     ion_phys_addr_t *addr, size_t *len);
+
+/**
  * ion_map_dma - return an sg_table describing a handle
  * @client:	the client
  * @handle:	the handle
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-01-19  2:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-04  7:11 [PATCH 1/2] staging: andriod: ion: Add ion_phys_get_by_id function Feng Tang
2015-01-04  7:11 ` [PATCH 2/2] staging: android: ion: Add pss info for each ion_client Feng Tang
2015-01-05 14:24 ` [PATCH 1/2] staging: andriod: ion: Add ion_phys_get_by_id function One Thousand Gnomes
2015-01-05 15:51   ` Tang, Feng
2015-01-18  0:04     ` Greg KH
2015-01-19  1:14       ` Tang, Feng
2015-01-19  1:58         ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox