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

Ezequiel Garcia ezequiel at collabora.com
Wed Mar 3 21:56:23 GMT 2021


On Wed, 2021-03-03 at 12:39 +0100, Benjamin Gaignard wrote:
> 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 at 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




More information about the linux-arm-kernel mailing list