Commit d1ff4e17 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Mauro Carvalho Chehab

[media] s5p-mfc: Allocate firmware with internal private buffer alloc function

Once firmware buffer has been converted to use s5p_mfc_priv_buf structure,
it is possible to allocate it with existing s5p_mfc_alloc_priv_buf()
function. This change will help to reduce code variants in the next
patches.
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Acked-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Tested-by: default avatarSmitha T Murthy <smitha.t@samsung.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 94eaccc0
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev)
{ {
struct s5p_mfc_priv_buf *fw_buf = &dev->fw_buf; struct s5p_mfc_priv_buf *fw_buf = &dev->fw_buf;
int err;
fw_buf->size = dev->variant->buf_size->fw; fw_buf->size = dev->variant->buf_size->fw;
...@@ -35,11 +36,10 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) ...@@ -35,11 +36,10 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev)
return -ENOMEM; return -ENOMEM;
} }
fw_buf->virt = dma_alloc_coherent(dev->mem_dev[BANK1_CTX], fw_buf->size, err = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &dev->fw_buf);
&fw_buf->dma, GFP_KERNEL); if (err) {
if (!fw_buf->virt) {
mfc_err("Allocating bitprocessor buffer failed\n"); mfc_err("Allocating bitprocessor buffer failed\n");
return -ENOMEM; return err;
} }
return 0; return 0;
...@@ -92,11 +92,7 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) ...@@ -92,11 +92,7 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev)
{ {
/* Before calling this function one has to make sure /* Before calling this function one has to make sure
* that MFC is no longer processing */ * that MFC is no longer processing */
if (!dev->fw_buf.virt) s5p_mfc_release_priv_buf(dev, &dev->fw_buf);
return -EINVAL;
dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_buf.size,
dev->fw_buf.virt, dev->fw_buf.dma);
dev->fw_buf.virt = NULL;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment