linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: labbott@redhat.com (Laura Abbott)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3 10/22] staging: android: ion: Remove import interface
Date: Mon,  3 Apr 2017 11:57:52 -0700	[thread overview]
Message-ID: <1491245884-15852-11-git-send-email-labbott@redhat.com> (raw)
In-Reply-To: <1491245884-15852-1-git-send-email-labbott@redhat.com>

With the expansion of dma-buf and the move for Ion to be come just an
allocator, the import mechanism is mostly useless. There isn't a kernel
component to Ion anymore and handles are private to Ion. Remove this
interface.

Signed-off-by: Laura Abbott <labbott@redhat.com>
---
 drivers/staging/android/ion/compat_ion.c |  1 -
 drivers/staging/android/ion/ion-ioctl.c  | 11 -----
 drivers/staging/android/ion/ion.c        | 76 --------------------------------
 drivers/staging/android/uapi/ion.h       |  9 ----
 4 files changed, 97 deletions(-)

diff --git a/drivers/staging/android/ion/compat_ion.c b/drivers/staging/android/ion/compat_ion.c
index 5b192ea..ae1ffc3 100644
--- a/drivers/staging/android/ion/compat_ion.c
+++ b/drivers/staging/android/ion/compat_ion.c
@@ -145,7 +145,6 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	}
 	case ION_IOC_SHARE:
 	case ION_IOC_MAP:
-	case ION_IOC_IMPORT:
 		return filp->f_op->unlocked_ioctl(filp, cmd,
 						(unsigned long)compat_ptr(arg));
 	default:
diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
index 2b475bf..7b54eea 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -131,17 +131,6 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 			ret = data.fd.fd;
 		break;
 	}
-	case ION_IOC_IMPORT:
-	{
-		struct ion_handle *handle;
-
-		handle = ion_import_dma_buf_fd(client, data.fd.fd);
-		if (IS_ERR(handle))
-			ret = PTR_ERR(handle);
-		else
-			data.handle.handle = handle->id;
-		break;
-	}
 	case ION_IOC_HEAP_QUERY:
 		ret = ion_query_heaps(client, &data.query);
 		break;
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 125c537..3d979ef5 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -274,24 +274,6 @@ int ion_handle_put(struct ion_handle *handle)
 	return ret;
 }
 
-static struct ion_handle *ion_handle_lookup(struct ion_client *client,
-					    struct ion_buffer *buffer)
-{
-	struct rb_node *n = client->handles.rb_node;
-
-	while (n) {
-		struct ion_handle *entry = rb_entry(n, struct ion_handle, node);
-
-		if (buffer < entry->buffer)
-			n = n->rb_left;
-		else if (buffer > entry->buffer)
-			n = n->rb_right;
-		else
-			return entry;
-	}
-	return ERR_PTR(-EINVAL);
-}
-
 struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client *client,
 					       int id)
 {
@@ -1023,64 +1005,6 @@ int ion_share_dma_buf_fd(struct ion_client *client, struct ion_handle *handle)
 }
 EXPORT_SYMBOL(ion_share_dma_buf_fd);
 
-struct ion_handle *ion_import_dma_buf(struct ion_client *client,
-				      struct dma_buf *dmabuf)
-{
-	struct ion_buffer *buffer;
-	struct ion_handle *handle;
-	int ret;
-
-	/* if this memory came from ion */
-
-	if (dmabuf->ops != &dma_buf_ops) {
-		pr_err("%s: can not import dmabuf from another exporter\n",
-		       __func__);
-		return ERR_PTR(-EINVAL);
-	}
-	buffer = dmabuf->priv;
-
-	mutex_lock(&client->lock);
-	/* if a handle exists for this buffer just take a reference to it */
-	handle = ion_handle_lookup(client, buffer);
-	if (!IS_ERR(handle)) {
-		ion_handle_get(handle);
-		mutex_unlock(&client->lock);
-		goto end;
-	}
-
-	handle = ion_handle_create(client, buffer);
-	if (IS_ERR(handle)) {
-		mutex_unlock(&client->lock);
-		goto end;
-	}
-
-	ret = ion_handle_add(client, handle);
-	mutex_unlock(&client->lock);
-	if (ret) {
-		ion_handle_put(handle);
-		handle = ERR_PTR(ret);
-	}
-
-end:
-	return handle;
-}
-EXPORT_SYMBOL(ion_import_dma_buf);
-
-struct ion_handle *ion_import_dma_buf_fd(struct ion_client *client, int fd)
-{
-	struct dma_buf *dmabuf;
-	struct ion_handle *handle;
-
-	dmabuf = dma_buf_get(fd);
-	if (IS_ERR(dmabuf))
-		return ERR_CAST(dmabuf);
-
-	handle = ion_import_dma_buf(client, dmabuf);
-	dma_buf_put(dmabuf);
-	return handle;
-}
-EXPORT_SYMBOL(ion_import_dma_buf_fd);
-
 int ion_query_heaps(struct ion_client *client, struct ion_heap_query *query)
 {
 	struct ion_device *dev = client->dev;
diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h
index 8ff471d..3a59044 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -185,15 +185,6 @@ struct ion_heap_query {
 #define ION_IOC_SHARE		_IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
 
 /**
- * DOC: ION_IOC_IMPORT - imports a shared file descriptor
- *
- * Takes an ion_fd_data struct with the fd field populated with a valid file
- * descriptor obtained from ION_IOC_SHARE and returns the struct with the handle
- * filed set to the corresponding opaque handle.
- */
-#define ION_IOC_IMPORT		_IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
-
-/**
  * DOC: ION_IOC_HEAP_QUERY - information about available heaps
  *
  * Takes an ion_heap_query structure and populates information about
-- 
2.7.4

  parent reply	other threads:[~2017-04-03 18:57 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 18:57 [PATCHv3 00/22] Ion clean up in preparation in moving out of staging Laura Abbott
2017-04-03 18:57 ` [PATCHv3 01/22] cma: Store a name in the cma structure Laura Abbott
2017-04-03 18:57 ` [PATCHv3 02/22] cma: Introduce cma_for_each_area Laura Abbott
2017-04-03 18:57 ` [PATCHv3 03/22] staging: android: ion: Remove dmap_cnt Laura Abbott
2017-04-03 18:57 ` [PATCHv3 04/22] staging: android: ion: Remove alignment from allocation field Laura Abbott
2017-04-03 18:57 ` [PATCHv3 05/22] staging: android: ion: Duplicate sg_table Laura Abbott
2017-04-03 18:57 ` [PATCHv3 06/22] staging: android: ion: Call dma_map_sg for syncing and mapping Laura Abbott
2017-04-03 18:57 ` [PATCHv3 07/22] staging: android: ion: Remove page faulting support Laura Abbott
2017-04-11  6:00   ` Archit Taneja
2017-04-03 18:57 ` [PATCHv3 08/22] staging: android: ion: Remove crufty cache support Laura Abbott
2017-04-11  5:08   ` Archit Taneja
2017-04-03 18:57 ` [PATCHv3 09/22] staging: android: ion: Remove custom ioctl interface Laura Abbott
2017-04-03 18:57 ` Laura Abbott [this message]
2017-04-03 18:57 ` [PATCHv3 11/22] staging: android: ion: Remove duplicate ION_IOC_MAP Laura Abbott
2017-04-03 18:57 ` [PATCHv3 12/22] staging: android: ion: Remove old platform support Laura Abbott
2017-04-03 18:57 ` [PATCHv3 13/22] staging: android: ion: Use CMA APIs directly Laura Abbott
2017-04-11  6:47   ` Laurent Pinchart
2017-04-11 16:48     ` Laura Abbott
2017-04-18 14:07   ` Greg Kroah-Hartman
2017-04-03 18:57 ` [PATCHv3 14/22] staging: android: ion: Stop butchering the DMA address Laura Abbott
2017-04-03 18:57 ` [PATCHv3 15/22] staging: android: ion: Break the ABI in the name of forward progress Laura Abbott
2017-04-03 18:57 ` [PATCHv3 16/22] staging: android: ion: Get rid of ion_phys_addr_t Laura Abbott
2017-04-03 18:57 ` [PATCHv3 17/22] staging: android: ion: Collapse internal header files Laura Abbott
2017-04-08 18:12   ` Emil Velikov
2017-04-10 15:10     ` Laura Abbott
2017-04-03 18:58 ` [PATCHv3 18/22] staging: android: ion: Rework heap registration/enumeration Laura Abbott
2017-04-03 18:58 ` [PATCHv3 19/22] staging: android: ion: Drop ion_map_kernel interface Laura Abbott
2017-04-03 18:58 ` [PATCHv3 20/22] staging: android: ion: Remove ion_handle and ion_client Laura Abbott
2017-04-03 18:58 ` [PATCHv3 21/22] staging: android: ion: Set query return value Laura Abbott
2017-04-03 18:58 ` [PATCHv3 22/22] staging/android: Update Ion TODO list Laura Abbott
2017-04-08 10:38 ` [PATCHv3 00/22] Ion clean up in preparation in moving out of staging Greg Kroah-Hartman
2017-04-10 16:20   ` Laura Abbott
2017-04-10 16:25     ` Greg Kroah-Hartman
2017-04-10 17:20       ` Laura Abbott

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=1491245884-15852-11-git-send-email-labbott@redhat.com \
    --to=labbott@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).