video: adf: build fixes for 4.1

Couple of ADF build fixes for v4.1

adf/adf_fops.c fix:
get_unused_fd() is obsolete, use get_unused_fd_flags(O_CLOEXEC)
instead to allocate a default file descriptor. This fix is a
followup of upstream commit f938612dd9 "include/linux/file.h:
remove get_unused_fd() macro".

adf/adf_memblock.c fix:
Fix dma_buf_export() call. Based on mainline commit d8fbe341be
"dma-buf: cleanup dma_buf_export() to make it easily extensible".

Otherwise we run into following build failures:
----------
  CC      drivers/video/adf/adf_fops.o
  CC      drivers/video/adf/adf_memblock.o
drivers/video/adf/adf_memblock.c: In function ‘adf_memblock_export’:
drivers/video/adf/adf_memblock.c:154:2: warning: passing argument 1 of ‘dma_buf_export’ from incompatible pointer type [enabled by default]
In file included from drivers/video/adf/adf_memblock.c:15:0:
include/linux/dma-buf.h:211:17: note: expected ‘const struct dma_buf_export_info *’ but argument is of type ‘struct adf_memblock_pdata *’
drivers/video/adf/adf_memblock.c:154:2: error: too many arguments to function ‘dma_buf_export’
In file included from drivers/video/adf/adf_memblock.c:15:0:
include/linux/dma-buf.h:211:17: note: declared here
make[3]: *** [drivers/video/adf/adf_memblock.o] Error 1
make[3]: *** Waiting for unfinished jobs....
drivers/video/adf/adf_fops.c: In function ‘adf_device_post_config’:
drivers/video/adf/adf_fops.c:228:2: error: implicit declaration of function ‘get_unused_fd’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[3]: *** [drivers/video/adf/adf_fops.o] Error 1
make[2]: *** [drivers/video/adf] Error 2
make[2]: *** Waiting for unfinished jobs....
----------

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
This commit is contained in:
Amit Pundir 2015-07-07 01:09:40 +05:30 committed by John Stultz
parent aaec4221bc
commit b76c913436
2 changed files with 9 additions and 3 deletions

View file

@ -225,7 +225,7 @@ static int adf_device_post_config(struct adf_device *dev,
size_t custom_data_size;
int ret = 0;
complete_fence_fd = get_unused_fd();
complete_fence_fd = get_unused_fd_flags(O_CLOEXEC);
if (complete_fence_fd < 0)
return complete_fence_fd;
@ -347,7 +347,7 @@ static int adf_intf_simple_post_config(struct adf_interface *intf,
struct adf_buffer buf;
int ret = 0;
complete_fence_fd = get_unused_fd();
complete_fence_fd = get_unused_fd_flags(O_CLOEXEC);
if (complete_fence_fd < 0)
return complete_fence_fd;

View file

@ -142,6 +142,7 @@ struct dma_buf *adf_memblock_export(phys_addr_t base, size_t size, int flags)
{
struct adf_memblock_pdata *pdata;
struct dma_buf *buf;
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
if (PAGE_ALIGN(base) != base || PAGE_ALIGN(size) != size)
return ERR_PTR(-EINVAL);
@ -151,7 +152,12 @@ struct dma_buf *adf_memblock_export(phys_addr_t base, size_t size, int flags)
return ERR_PTR(-ENOMEM);
pdata->base = base;
buf = dma_buf_export(pdata, &adf_memblock_ops, size, flags, NULL);
exp_info.ops = &adf_memblock_ops;
exp_info.size = size;
exp_info.flags = flags;
exp_info.priv = pdata;
buf = dma_buf_export(&exp_info);
if (IS_ERR(buf))
kfree(pdata);