From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
linaro-mm-sig@lists.linaro.org, sumit.semwal@linaro.org,
airlied@linux.ie, daniel.vetter@ffwll.ch,
kyungmin.park@samsung.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH 1/2] dma-buf: add importer private data to attachment
Date: Wed, 05 Jun 2013 15:23:35 +0200 [thread overview]
Message-ID: <51AF3BD7.5070001@canonical.com> (raw)
In-Reply-To: <1369990487-23510-2-git-send-email-sw0312.kim@samsung.com>
Op 31-05-13 10:54, Seung-Woo Kim schreef:
> dma-buf attachment has only exporter private data, but importer private data
> can be useful for importer especially to re-import the same dma-buf.
> To use importer private data in attachment of the device, the function to
> search attachment in the attachment list of dma-buf is also added.
>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
> drivers/base/dma-buf.c | 31 +++++++++++++++++++++++++++++++
> include/linux/dma-buf.h | 4 ++++
> 2 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
> index 08fe897..a1eaaf2 100644
> --- a/drivers/base/dma-buf.c
> +++ b/drivers/base/dma-buf.c
> @@ -259,6 +259,37 @@ err_attach:
> EXPORT_SYMBOL_GPL(dma_buf_attach);
>
> /**
> + * dma_buf_get_attachment - Get attachment with the device from dma_buf's
> + * attachments list
> + * @dmabuf: [in] buffer to find device from.
> + * @dev: [in] device to be found.
> + *
> + * Returns struct dma_buf_attachment * attaching the device; may return
> + * negative error codes.
> + *
> + */
> +struct dma_buf_attachment *dma_buf_get_attachment(struct dma_buf *dmabuf,
> + struct device *dev)
> +{
> + struct dma_buf_attachment *attach;
> +
> + if (WARN_ON(!dmabuf || !dev))
> + return ERR_PTR(-EINVAL);
> +
> + mutex_lock(&dmabuf->lock);
> + list_for_each_entry(attach, &dmabuf->attachments, node) {
> + if (attach->dev == dev) {
> + mutex_unlock(&dmabuf->lock);
> + return attach;
> + }
> + }
> + mutex_unlock(&dmabuf->lock);
> +
> + return ERR_PTR(-ENODEV);
> +}
> +EXPORT_SYMBOL_GPL(dma_buf_get_attachment);
NAK in any form..
Spot the race condition between dma_buf_get_attachment and dma_buf_attach....
~Maarten
next prev parent reply other threads:[~2013-06-05 13:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-31 8:54 [RFC][PATCH 0/2] dma-buf: add importer private data for reimporting Seung-Woo Kim
2013-05-31 8:54 ` [RFC][PATCH 1/2] dma-buf: add importer private data to attachment Seung-Woo Kim
2013-06-05 13:23 ` Maarten Lankhorst [this message]
2013-06-07 2:32 ` 김승우
2013-06-07 11:24 ` Maarten Lankhorst
2013-06-10 0:23 ` 김승우
2013-05-31 8:54 ` [RFC][PATCH 2/2] drm/prime: find gem object from the reimported dma-buf Seung-Woo Kim
2013-05-31 9:14 ` [RFC][PATCH 0/2] dma-buf: add importer private data for reimporting Daniel Vetter
2013-05-31 10:22 ` 김승우
2013-05-31 15:29 ` Daniel Vetter
2013-05-31 16:21 ` Lucas Stach
2013-05-31 20:25 ` Daniel Vetter
2013-06-04 10:42 ` 김승우
2013-06-04 12:55 ` Daniel Vetter
2013-06-05 2:52 ` 김승우
2013-06-05 8:38 ` Daniel Vetter
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=51AF3BD7.5070001@canonical.com \
--to=maarten.lankhorst@canonical.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kyungmin.park@samsung.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=sw0312.kim@samsung.com \
/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