Thread (22 messages) read the whole thread 22 messages, 3 authors, 2021-03-16

Re: [PATCH v4 03/11] media: hantro: change hantro_codec_ops run prototype to return errors

From: Ezequiel Garcia <hidden>
Date: 2021-03-04 00:10:58
Also in: linux-arm-kernel, linux-devicetree, linux-rockchip, lkml

On Wed, 2021-03-03 at 12:39 +0100, Benjamin Gaignard wrote:
quoted hunk ↗ jump to hunk
Change hantro_codec_ops run prototype from 'void' to 'int'.
This allow to cancel the job if an error occur while configuring
the hardware.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
 drivers/staging/media/hantro/hantro_drv.c     |  4 +++-
 .../staging/media/hantro/hantro_g1_h264_dec.c |  6 ++++--
 .../media/hantro/hantro_g1_mpeg2_dec.c        |  4 +++-
 .../staging/media/hantro/hantro_g1_vp8_dec.c  |  6 ++++--
 .../staging/media/hantro/hantro_h1_jpeg_enc.c |  4 +++-
 drivers/staging/media/hantro/hantro_hw.h      | 19 ++++++++++---------
 .../media/hantro/rk3399_vpu_hw_jpeg_enc.c     |  4 +++-
 .../media/hantro/rk3399_vpu_hw_mpeg2_dec.c    |  4 +++-
 .../media/hantro/rk3399_vpu_hw_vp8_dec.c      |  6 ++++--
 9 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
index e5f200e64993..ac1429f00b33 100644
--- a/drivers/staging/media/hantro/hantro_drv.c
+++ b/drivers/staging/media/hantro/hantro_drv.c
@@ -161,7 +161,9 @@ static void device_run(void *priv)
 
        v4l2_m2m_buf_copy_metadata(src, dst, true);
 
-       ctx->codec_ops->run(ctx);
+       if (ctx->codec_ops->run(ctx))
+               goto err_cancel_job;
+
        return;
 
 err_cancel_job:
diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c
index 845bef73d218..fcd4db13c9fe 100644
--- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c
+++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c
@@ -273,13 +273,13 @@ static void set_buffers(struct hantro_ctx *ctx)
        vdpu_write_relaxed(vpu, ctx->h264_dec.priv.dma, G1_REG_ADDR_QTABLE);
 }
 
-void hantro_g1_h264_dec_run(struct hantro_ctx *ctx)
+int hantro_g1_h264_dec_run(struct hantro_ctx *ctx)
 {
        struct hantro_dev *vpu = ctx->dev;
 
        /* Prepare the H264 decoder context. */
        if (hantro_h264_dec_prepare_run(ctx))
-               return;
+               return -EINVAL;
This should be returning the value from hantro_h264_dec_prepare_run.

Thanks!
Ezequiel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help