From f4a1a0de1aa5e3baab238b37ecd9e7a89d9ca213 Mon Sep 17 00:00:00 2001 From: Ard van Breemen Date: Wed, 22 Mar 2017 16:18:18 +0100 Subject: [PATCH] Revert "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." This reverts commit 7866d659552947c98f688df0d6080b141b96f8c7. --- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index a1811ee538bd..b0cf3970117a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -27,7 +27,6 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) { struct s5p_mfc_priv_buf *fw_buf = &dev->fw_buf; - int err; fw_buf->size = dev->variant->buf_size->fw; @@ -36,10 +35,11 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) return -ENOMEM; } - err = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &dev->fw_buf); - if (err) { + fw_buf->virt = dma_alloc_coherent(dev->mem_dev[BANK1_CTX], fw_buf->size, + &fw_buf->dma, GFP_KERNEL); + if (!fw_buf->virt) { mfc_err("Allocating bitprocessor buffer failed\n"); - return err; + return -ENOMEM; } return 0; @@ -92,7 +92,11 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) { /* Before calling this function one has to make sure * that MFC is no longer processing */ - s5p_mfc_release_priv_buf(dev, &dev->fw_buf); + if (!dev->fw_buf.virt) + 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; }