mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
	linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com
Cc: Maxime Ripard <maxime.ripard@bootlin.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH] media: cedrus: Forbid setting new formats on busy queues
Date: Thu, 14 Feb 2019 10:18:38 +0100	[thread overview]
Message-ID: <0b6bd0f8f1ad67e85e00127dbf1b2c7e78efbfd0.camel@bootlin.com> (raw)
In-Reply-To: <3b24ac73-f891-533f-8563-fe38ba4a83ca@xs4all.nl>

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@bootlin.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


  reply	other threads:[~2019-02-14  9:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14  8:37 Paul Kocialkowski
2019-02-14  8:59 ` Hans Verkuil
2019-02-14  9:18   ` Paul Kocialkowski [this message]
2019-02-14  9:20     ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b6bd0f8f1ad67e85e00127dbf1b2c7e78efbfd0.camel@bootlin.com \
    --to=paul.kocialkowski@bootlin.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=mchehab@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®