dma-buf: pass flags into dma_buf_fd.
authorDave Airlie <airlied@redhat.com>
Fri, 16 Mar 2012 10:34:02 +0000 (10:34 +0000)
committerSumit Semwal <sumit.semwal@ti.com>
Mon, 26 Mar 2012 06:02:26 +0000 (11:32 +0530)
We need to pass the flags into dma_buf_fd at this point,
so the flags end up doing the right thing for O_CLOEXEC.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
drivers/base/dma-buf.c
include/linux/dma-buf.h

index c9a945fd1a0435cb9a9a3fbff96332a0f9fc2bd5..3c8c0232ce431285c5737fa1b1e521c2a76dfc51 100644 (file)
@@ -107,17 +107,18 @@ EXPORT_SYMBOL_GPL(dma_buf_export);
 /**
  * dma_buf_fd - returns a file descriptor for the given dma_buf
  * @dmabuf:    [in]    pointer to dma_buf for which fd is required.
+ * @flags:      [in]    flags to give to fd
  *
  * On success, returns an associated 'fd'. Else, returns error.
  */
-int dma_buf_fd(struct dma_buf *dmabuf)
+int dma_buf_fd(struct dma_buf *dmabuf, int flags)
 {
        int error, fd;
 
        if (!dmabuf || !dmabuf->file)
                return -EINVAL;
 
-       error = get_unused_fd();
+       error = get_unused_fd_flags(flags);
        if (error < 0)
                return error;
        fd = error;
index a885b2689b8f9c6988df70b40aaa423294a3baf9..891457a86b30ba59a2faf5fbdf8b3850a558e9f0 100644 (file)
@@ -117,7 +117,7 @@ void dma_buf_detach(struct dma_buf *dmabuf,
                                struct dma_buf_attachment *dmabuf_attach);
 struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops,
                               size_t size, int flags);
-int dma_buf_fd(struct dma_buf *dmabuf);
+int dma_buf_fd(struct dma_buf *dmabuf, int flags);
 struct dma_buf *dma_buf_get(int fd);
 void dma_buf_put(struct dma_buf *dmabuf);