From: Feng Tang <feng.tang@intel.com>
To: Greg KH <gregkh@linuxfoundation.org>,
John Stultz <john.stultz@linaro.org>
Cc: Colin Cross <ccross@android.com>,
Heesub Shin <heesub.shin@samsung.com>,
Mitchel Humpherys <mitchelh@codeaurora.org>,
linux-kernel@vger.kernel.org, Feng Tang <feng.tang@intel.com>
Subject: [PATCH 1/2] staging: andriod: ion: Add ion_phys_get_by_id function
Date: Sun, 4 Jan 2015 15:11:51 +0800 [thread overview]
Message-ID: <1420355512-31129-1-git-send-email-feng.tang@intel.com> (raw)
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
next reply other threads:[~2015-01-04 7:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-04 7:11 Feng Tang [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1420355512-31129-1-git-send-email-feng.tang@intel.com \
--to=feng.tang@intel.com \
--cc=ccross@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=heesub.shin@samsung.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mitchelh@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®