On 08/11/2021 17:02, Niklas Söderlund wrote: > When a subdevice signals a transfer error stop the VIN in addition to > informing user-space of the event. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx> > Reviewed-by: Jacopo Mondi <jacopo+renesas@xxxxxxxxxx> > --- > * Changes since v3 > - Switch to new V4L2_EVENT_XFER_ERROR from V4L2_EVENT_EOS. > - Call vb2_queue_error() when encountering the event. > > * Changes since v2 > - Log using vin_dbg() instead of v4l2_info(). > --- > drivers/media/platform/rcar-vin/rcar-v4l2.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c > index a5bfa76fdac6e55a..bf17fdefe90aabf5 100644 > --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c > +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c > @@ -992,9 +992,24 @@ void rvin_v4l2_unregister(struct rvin_dev *vin) > static void rvin_notify_video_device(struct rvin_dev *vin, > unsigned int notification, void *arg) > { > + const struct v4l2_event *event; > + > switch (notification) { > case V4L2_DEVICE_NOTIFY_EVENT: > - v4l2_event_queue(&vin->vdev, arg); > + event = arg; > + > + switch (event->type) { > + case V4L2_EVENT_XFER_ERROR: > + vin_dbg(vin, > + "Subdevice signaled transfer error, stopping.\n"); > + rvin_stop_streaming(vin); > + vb2_queue_error(&vin->queue); Hmm, wouldn't it be the case that every driver that calls vb2_queue_error() would also have to send this new event? Would it be possible to modify vb2_queue_error() to raise this event? I haven't analyzed all the drivers that call this function to see if that makes sense. Perhaps a separate new function vb2_queue_error_with_event() would also be an option. Regards, Hans > + break; > + default: > + break; > + } > + > + v4l2_event_queue(&vin->vdev, event); > break; > default: > break; >