On Thu, Mar 13, 2025 at 11:24:26AM +0100, Stanislaw Gruszka wrote: > Extract values needed by ipu6_queue_buf_ready() function from fw abi > structure. This will allow to reuse same buf ready code when fw abi > change. > > Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@xxxxxxxxxxxxxxx> > --- > .../media/pci/intel/ipu6/ipu6-isys-queue.c | 28 ++++++++++++------- > 1 file changed, 18 insertions(+), 10 deletions(-) > > diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c > index c68dc577daf0..c7f302df2dcc 100644 > --- a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c > +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c > @@ -734,10 +734,11 @@ static void ipu6_isys_queue_buf_done(struct ipu6_isys_buffer *ib) > } > } > > -void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream, > - struct ipu6_fw_isys_resp_info_abi *info) > +static void > +ipu6_stream_buf_ready(struct ipu6_isys_stream *stream, u8 pin_id, u32 addr, > + u64 time, bool error_check) > { > - struct ipu6_isys_queue *aq = stream->output_pins[info->pin_id].aq; > + struct ipu6_isys_queue *aq = stream->output_pins[pin_id].aq; > struct ipu6_isys *isys = stream->isys; > struct device *dev = &isys->adev->auxdev.dev; > struct ipu6_isys_buffer *ib; > @@ -745,7 +746,6 @@ void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream, > unsigned long flags; > bool first = true; > struct vb2_v4l2_buffer *buf; > - u64 time = (u64)info->timestamp[1] << 32 | info->timestamp[0]; > > spin_lock_irqsave(&aq->lock, flags); > if (list_empty(&aq->active)) { > @@ -757,23 +757,22 @@ void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream, > list_for_each_entry_reverse(ib, &aq->active, head) { > struct ipu6_isys_video_buffer *ivb; > struct vb2_v4l2_buffer *vvb; > - dma_addr_t addr; > + dma_addr_t dma_addr; > > vb = ipu6_isys_buffer_to_vb2_buffer(ib); > vvb = to_vb2_v4l2_buffer(vb); > ivb = vb2_buffer_to_ipu6_isys_video_buffer(vvb); > - addr = ivb->dma_addr; > + dma_addr = ivb->dma_addr; > > - if (info->pin.addr != addr) { > + if (addr != dma_addr) { > if (first) > dev_err(dev, "Unexpected buffer address %pad\n", > - &addr); > + &dma_addr); > first = false; > continue; > } > > - if (info->error_info.error == > - IPU6_FW_ISYS_ERROR_HW_REPORTED_STR2MMIO) { > + if (error_check) { > /* > * Check for error message: > * 'IPU6_FW_ISYS_ERROR_HW_REPORTED_STR2MMIO' > @@ -800,6 +799,15 @@ void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream, > spin_unlock_irqrestore(&aq->lock, flags); > } > > +void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream, > + struct ipu6_fw_isys_resp_info_abi *info) > +{ > + u64 time = (u64)info->timestamp[1] << 32 | info->timestamp[0]; > + bool err = (info->error_info.error == IPU6_FW_ISYS_ERROR_HW_REPORTED_STR2MMIO); Redundant parentheses. > + > + ipu6_stream_buf_ready(stream, info->pin_id, info->pin.addr, time, err); > +} > + > static const struct vb2_ops ipu6_isys_queue_ops = { > .queue_setup = ipu6_isys_queue_setup, > .buf_init = ipu6_isys_buf_init, -- Sakari Ailus