From patchwork Sat Mar 18 00:54:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9631845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 47EFD60249 for ; Sat, 18 Mar 2017 00:57:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 395082841F for ; Sat, 18 Mar 2017 00:57:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D6BE284A5; Sat, 18 Mar 2017 00:57:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BEEE12841F for ; Sat, 18 Mar 2017 00:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=WQ5Y3i7MzLa8H+XZOvOuv2aa3wRBs9CtpTQtWhqdS1M=; b=TDY1wgdnTKsu70107Rt7qh5MWB 27uGY3Zb3qDUpUPxr/vwmnwzX8Ia7CKYfoZ6+okauV2cUqw3bt6R/c5Luxy35zUhzH5UjVoLE5esQ nQuKEHICPXLwhxJFoGkelR+rojpqGFuRpD+9nQ6EKjwO6RLO1FUrZJgH1qfYmmxbbWJQkuJkt5dF6 G5u+IKtFDO2w2YnKxavQPn2Lfevz70wCdeeq7cZnowJEc/BXbD+6oYsZ+WnMY1qRERq55gzKop24W RFuf9rdrcyuBffz4M/aJZdrlH/NoODKLC3ypDdhVsBL66Skiwu19FWHqdG0468K1Tb6L9C+5+drb8 2x6RpT2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cp2go-0005xt-DU; Sat, 18 Mar 2017 00:57:50 +0000 Received: from mail-qk0-f180.google.com ([209.85.220.180]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cp2ew-0003b1-9p for linux-arm-kernel@lists.infradead.org; Sat, 18 Mar 2017 00:55:58 +0000 Received: by mail-qk0-f180.google.com with SMTP id y76so77317826qkb.0 for ; Fri, 17 Mar 2017 17:55:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JmxkMqWgNUwZ0oRJmbtk74XDKlxG3/aP6EXLrSmAelQ=; b=X9gDGZfPiqGjgwBiylZkRiGalzbuQvsqGnJW4pQqT0o0q89ui5tqsfm1iR/gKWWCoJ fAz/xLXxAzwZSJkdn4WWaG8IQYA2H4LC2gR1FQse9YSOqAbU3lSWrzHZIPWMksyCmxS8 9/N9d7upHtCRo1qoMyGIfcqinBn7fpAPHjFWkOqa12NK/1+kaNWQxgLXVH8B4u+Tbc7J +Go0pFBKI+ZBUtySnM9qPmRNgcegW5bAcTyeZfQdZCY30d8IDRArKvECE1XTlmFfOPtt jjCFpFQJKgsLBwXk/75T0NqfpcK78wV++RdCCvVdgFijNqf9sac8Z7imcXZup3jUip4C QGQA== X-Gm-Message-State: AFeK/H0ZqivS9ysaj9gQoRyXnfSaBqfAR7EpXOBUieDvLuUWXxDlgiQlahsONdvaCqC8eTsH X-Received: by 10.55.19.197 with SMTP id 66mr14651720qkt.73.1489798532979; Fri, 17 Mar 2017 17:55:32 -0700 (PDT) Received: from labbott-redhat-machine.redhat.com ([2601:602:9802:a8dc:1722:8a6b:a66c:79eb]) by smtp.gmail.com with ESMTPSA id e55sm7118568qte.52.2017.03.17.17.55.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Mar 2017 17:55:31 -0700 (PDT) From: Laura Abbott To: Sumit Semwal , Riley Andrews , arve@android.com Subject: [RFC PATCHv2 10/21] staging: android: ion: Remove import interface Date: Fri, 17 Mar 2017 17:54:42 -0700 Message-Id: <1489798493-16600-11-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489798493-16600-1-git-send-email-labbott@redhat.com> References: <1489798493-16600-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170317_175554_660085_CE52FFE4 X-CRM114-Status: GOOD ( 14.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, romlem@google.com, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, Mark Brown , Laurent Pinchart , Benjamin Gaignard , Daniel Vetter , Laura Abbott , Brian Starkey , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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