Re: [PATCH 1/4] media: videobuf2: finish prepared buffers in VIDIOC_REMOVE_BUFS
From: Karl Mehltretter
Date: Wed Oct 21 2026 - 23:26:53 EST
Hello Tomasz,
On Thu, Oct 22, 2026 at 01:00:19AM +0100, Tomasz Figa wrote:
> > + __vb2_buf_mem_finish(vb);
> > + call_void_vb_qop(vb, buf_finish, vb);
> > + vb->prepared = 0;
> > + }
> > +
>
> __vb2_queue_cancel() does much more than that, especially all the
> media request handling. In addition, this open coded handling just
> causes code duplication.
>
> Would it make more sense to refactor the relevant part of the buffer
> cancelation loop from __vb2_queue_cancel() into a helper function and
> call it here instead?
>
Yes that makes sense. The complete per-buffer cancellation tail can be
moved into a shared helper, while keeping the REMOVE_BUFS range check
before any buffer is changed.
I can then send patch 1 separately from the DMA-BUF access work.
Thanks,
Karl