[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b6bd0f8f1ad67e85e00127dbf1b2c7e78efbfd0.camel@bootlin.com>
Date: Thu, 14 Feb 2019 10:18:38 +0100
From: Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To: Hans Verkuil <hverkuil@...all.nl>, linux-media@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-sunxi@...glegroups.com
Cc: Maxime Ripard <maxime.ripard@...tlin.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH] media: cedrus: Forbid setting new formats on busy queues
Hi,
On Thu, 2019-02-14 at 09:59 +0100, Hans Verkuil wrote:
> On 2/14/19 9:37 AM, Paul Kocialkowski wrote:
> > Check that our queues are not busy before setting the format or return
> > EBUSY if that's the case. This ensures that our format can't change
> > once buffers are allocated for the queue.
> >
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@...tlin.com>
> > ---
> > drivers/staging/media/sunxi/cedrus/cedrus_video.c | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > index b5cc79389d67..3420a938a613 100644
> > --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > @@ -282,8 +282,15 @@ static int cedrus_s_fmt_vid_cap(struct file *file, void *priv,
> > {
> > struct cedrus_ctx *ctx = cedrus_file2ctx(file);
> > struct cedrus_dev *dev = ctx->dev;
> > + struct vb2_queue *vq;
> > int ret;
> >
> > + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
> > + if (!vq)
> > + return -EINVAL;
>
> Can this ever happen?
I guess not, or something would be very wrong.
I have seen this check around when looking at how other drivers
implement this, but it does seem overkill.
Should I get rid of it in v2?
Cheers,
Paul
> Regards,
>
> Hans
>
> > + else if (vb2_is_busy(vq))
> > + return -EBUSY;
> > +
> > ret = cedrus_try_fmt_vid_cap(file, priv, f);
> > if (ret)
> > return ret;
> > @@ -299,8 +306,15 @@ static int cedrus_s_fmt_vid_out(struct file *file, void *priv,
> > struct v4l2_format *f)
> > {
> > struct cedrus_ctx *ctx = cedrus_file2ctx(file);
> > + struct vb2_queue *vq;
> > int ret;
> >
> > + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
> > + if (!vq)
> > + return -EINVAL;
> > + else if (vb2_is_busy(vq))
> > + return -EBUSY;
> > +
> > ret = cedrus_try_fmt_vid_out(file, priv, f);
> > if (ret)
> > return ret;
> >
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
Powered by blists - more mailing lists