Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: hantro: Use vb2_find_buffer

Use the newly introduced vb2_find_buffer API to get a vb2_buffer
given a buffer timestamp.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Ezequiel Garcia and committed by
Mauro Carvalho Chehab
d642f7c8 5b25e543

+7 -9
+2 -4
drivers/staging/media/hantro/hantro_drv.c
··· 47 47 { 48 48 struct vb2_queue *q = v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx); 49 49 struct vb2_buffer *buf; 50 - int index; 51 50 52 - index = vb2_find_timestamp(q, ts, 0); 53 - if (index < 0) 51 + buf = vb2_find_buffer(q, ts); 52 + if (!buf) 54 53 return 0; 55 - buf = vb2_get_buffer(q, index); 56 54 return hantro_get_dec_buf_addr(ctx, buf); 57 55 } 58 56
+5 -5
drivers/staging/media/hantro/hantro_g2_vp9_dec.c
··· 111 111 { 112 112 struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx; 113 113 struct vb2_queue *cap_q = &m2m_ctx->cap_q_ctx.q; 114 - int buf_idx; 114 + struct vb2_buffer *buf; 115 115 116 116 /* 117 117 * If a ref is unused or invalid, address of current destination 118 118 * buffer is returned. 119 119 */ 120 - buf_idx = vb2_find_timestamp(cap_q, timestamp, 0); 121 - if (buf_idx < 0) 122 - return vb2_to_hantro_decoded_buf(&dst->vb2_buf); 120 + buf = vb2_find_buffer(cap_q, timestamp); 121 + if (!buf) 122 + buf = &dst->vb2_buf; 123 123 124 - return vb2_to_hantro_decoded_buf(vb2_get_buffer(cap_q, buf_idx)); 124 + return vb2_to_hantro_decoded_buf(buf); 125 125 } 126 126 127 127 static void update_dec_buf_info(struct hantro_decoded_buffer *buf,