#include "mfc_mem.h"
-static int __mfc_alloc_common_context(struct mfc_dev *dev,
+static void __mfc_alloc_common_context(struct mfc_dev *dev,
enum mfc_buf_usage_type buf_type)
{
struct mfc_special_buf *ctx_buf;
unsigned long fw_daddr;
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
ctx_buf = &dev->common_ctx_buf;
fw_daddr = dev->fw_buf.daddr;
ctx_buf->daddr = fw_daddr + firmware_size;
mfc_debug_leave();
-
- return 0;
}
/* Wrapper : allocate context buffers for SYS_INIT */
-int mfc_alloc_common_context(struct mfc_dev *dev)
+void mfc_alloc_common_context(struct mfc_dev *dev)
{
- int ret = 0;
+ __mfc_alloc_common_context(dev, MFCBUF_NORMAL);
- ret = __mfc_alloc_common_context(dev, MFCBUF_NORMAL);
- if (ret)
- return ret;
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
- if (dev->fw.drm_status) {
- ret = __mfc_alloc_common_context(dev, MFCBUF_DRM);
- if (ret)
- return ret;
- }
+ if (dev->fw.drm_status)
+ __mfc_alloc_common_context(dev, MFCBUF_DRM);
#endif
-
- return ret;
}
/* Release context buffers for SYS_INIT */
{
struct mfc_special_buf *ctx_buf;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
-
ctx_buf = &dev->common_ctx_buf;
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
if (buf_type == MFCBUF_DRM)
/* Allocate memory for instance data buffer */
int mfc_alloc_instance_context(struct mfc_ctx *ctx)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
struct mfc_ctx_buf_size *buf_size;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
+
buf_size = dev->variant->buf_size->ctx_buf;
switch (ctx->codec_mode) {
/* Release instance buffer */
void mfc_release_instance_context(struct mfc_ctx *ctx)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
mfc_mem_ion_free(dev, &ctx->instance_ctx_buf);
mfc_debug(2, "[MEMINFO] Release the instance buffer ctx[%d]\n", ctx->num);
/* Allocate codec buffers */
int mfc_alloc_codec_buffers(struct mfc_ctx *ctx)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
if (ctx->type == MFCINST_DECODER) {
__mfc_dec_calc_codec_buffer_size(ctx);
/* Release buffers allocated for codec */
void mfc_release_codec_buffers(struct mfc_ctx *ctx)
{
- struct mfc_dev *dev;
-
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
+ struct mfc_dev *dev = ctx->dev;
mfc_mem_ion_free(dev, &ctx->codec_buf);
ctx->codec_buffer_allocated = 0;
}
/* Release buffer of debug infor memory for FW debugging */
-int mfc_release_dbg_info_buffer(struct mfc_dev *dev)
+void mfc_release_dbg_info_buffer(struct mfc_dev *dev)
{
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
- if (!dev->dbg_info_buf.dma_buf) {
+ if (!dev->dbg_info_buf.dma_buf)
mfc_debug(2, "debug info buffer is already freed\n");
- return 0;
- }
mfc_mem_ion_free(dev, &dev->dbg_info_buf);
mfc_debug(2, "[MEMINFO] Release the debug info buffer\n");
-
- return 0;
}
/* Allocation buffer of ROI macroblock information */
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[F/W] no mfc device to run\n");
- return -EINVAL;
- }
-
buf_size = dev->variant->buf_size->ctx_buf;
firmware_size = dev->variant->buf_size->firmware_code;
dev->fw.size = firmware_size + buf_size->dev_ctx;
size_t firmware_size;
int err;
- if (!dev) {
- mfc_err_dev("[F/W] no mfc device to run\n");
- return -EINVAL;
- }
-
firmware_size = dev->variant->buf_size->firmware_code;
/* Firmare has to be present as a separate file or compiled
{
/* Before calling this function one has to make sure
* that MFC is no longer processing */
- if (!dev) {
- mfc_err_dev("[F/W] no mfc device to run\n");
- return -EINVAL;
- }
-
if (!dev->fw_buf.dma_buf) {
mfc_err_dev("[F/W] firmware memory is already freed\n");
return -EINVAL;