staging: android: ion: Remove import interface
authorLaura Abbott <labbott@redhat.com>
Mon, 3 Apr 2017 18:57:52 +0000 (11:57 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Apr 2017 10:36:11 +0000 (12:36 +0200)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/compat_ion.c
drivers/staging/android/ion/ion-ioctl.c
drivers/staging/android/ion/ion.c
drivers/staging/android/uapi/ion.h

index 5b192ea5308b7867f49e5012de00334bac141571..ae1ffc38940033b94620de96efffec8d468549cb 100644 (file)
@@ -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:
index 2b475bfeab6ec995f8f5fec97ee6bc439c68c0bc..7b54eea22932849f7ef47fb5888993a8c221a8da 100644 (file)
@@ -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;
index 125c537e6492a3d9919de3c014cf3640384e0381..3d979ef543f6d1d3d4dc68ac7c2bf735bceb17fe 100644 (file)
@@ -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;
index 8ff471dce80672556ee97d676a165871d9f3f9bc..3a59044812b69b660fdcf4809335dea4d714d5be 100644 (file)
@@ -184,15 +184,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
  *