All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Andy Walls <awalls@md.metrocast.net>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	linux-media@vger.kernel.org, Steven Toth <stoth@kernellabs.com>,
	Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Subject: [PATCH] cx18: Move spinlock and vb_type initialisation into stream_init
Date: Tue, 10 May 2011 14:49:50 +0100	[thread overview]
Message-ID: <1305035390-31439-1-git-send-email-simon.farnsworth@onelan.co.uk> (raw)
In-Reply-To: <4DC2A8FD.4010902@infradead.org>

The initialisation of vb_type in serialized_open was preventing
REQBUFS from working reliably. Remove it, and move the spinlock into
stream_init for good measure - it's only used when we have a stream
that supports videobuf anyway.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
---
Mauro,

This fixes a bug I introduced, and noticed while trying to work out
how videobuf works and interacts with the rest of the driver, in
preparation for working out how to port this code to videobuf2.

Briefly, if you open a device node at the wrong time, you lose
videobuf support forever.

Please consider this for 2.6.40,

Simon

 drivers/media/video/cx18/cx18-fileops.c |    3 ---
 drivers/media/video/cx18/cx18-streams.c |    2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 6609222..07411f3 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -810,9 +810,6 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
 	item->cx = cx;
 	item->type = s->type;
 
-	spin_lock_init(&s->vbuf_q_lock);
-	s->vb_type = 0;
-
 	item->open_id = cx->open_id++;
 	filp->private_data = &item->fh;
 
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 24c9688..4282ff5 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -275,6 +275,8 @@ static void cx18_stream_init(struct cx18 *cx, int type)
 	init_timer(&s->vb_timeout);
 	spin_lock_init(&s->vb_lock);
 	if (type == CX18_ENC_STREAM_TYPE_YUV) {
+		spin_lock_init(&s->vbuf_q_lock);
+
 		s->vb_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 		videobuf_queue_vmalloc_init(&s->vbuf_q, &cx18_videobuf_qops,
 			&cx->pci_dev->dev, &s->vbuf_q_lock,
-- 
1.7.4


  parent reply	other threads:[~2011-05-10 13:50 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1QGwlS-0006ys-15@www.linuxtv.org>
2011-05-02 19:11 ` [git:v4l-dvb/for_v2.6.40] [media] cx18: mmap() support for raw YUV video capture Hans Verkuil
2011-05-02 19:21   ` Devin Heitmueller
2011-05-02 19:35   ` Mauro Carvalho Chehab
2011-05-02 19:40     ` Devin Heitmueller
2011-05-02 20:02     ` Hans Verkuil
2011-05-02 20:59       ` Devin Heitmueller
2011-05-02 21:31         ` Hans Verkuil
2011-05-03  1:59           ` Mauro Carvalho Chehab
2011-05-03  2:40           ` Andy Walls
2011-05-03  3:28             ` Mauro Carvalho Chehab
2011-05-03  5:15               ` Hans Verkuil
2011-05-03 11:29                 ` Mauro Carvalho Chehab
2011-05-03 13:07             ` Devin Heitmueller
2011-05-03 12:49           ` Devin Heitmueller
2011-05-03 13:59             ` Hans Verkuil
2011-05-03 14:26               ` Simon Farnsworth
2011-05-03 15:03               ` Mauro Carvalho Chehab
2011-05-03 16:13                 ` Hans Verkuil
2011-05-03  9:03     ` Simon Farnsworth
2011-05-03 10:56       ` Mauro Carvalho Chehab
2011-05-03 11:57         ` [PATCH] cx18: Clean up mmap() support for raw YUV Simon Farnsworth
2011-05-03 16:24           ` Hans Verkuil
2011-05-03 22:51           ` Andy Walls
2011-05-03 23:01             ` Mauro Carvalho Chehab
2011-05-03 23:38               ` Andy Walls
2011-05-04  0:17                 ` Mauro Carvalho Chehab
2011-05-04  9:32             ` Simon Farnsworth
2011-05-04 11:31               ` Mauro Carvalho Chehab
2011-05-04 11:39                 ` [PATCH] cx18: Bump driver version to 1.5.0 Simon Farnsworth
2011-05-04 12:20                   ` Andy Walls
2011-05-05 12:42                 ` [PATCH] cx18: Fix warnings introduced during cleanup Simon Farnsworth
2011-05-05 13:41                   ` Mauro Carvalho Chehab
2011-05-05 13:44                     ` Simon Farnsworth
2011-05-10 13:49                     ` Simon Farnsworth [this message]
2011-05-20 23:21                       ` [PATCH] cx18: Move spinlock and vb_type initialisation into stream_init Mauro Carvalho Chehab
2011-05-05 11:41               ` [PATCH] cx18: Clean up mmap() support for raw YUV Mauro Carvalho Chehab
2011-05-05 12:44                 ` Simon Farnsworth
2011-05-05 13:39                   ` Mauro Carvalho Chehab

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=1305035390-31439-1-git-send-email-simon.farnsworth@onelan.co.uk \
    --to=simon.farnsworth@onelan.co.uk \
    --cc=awalls@md.metrocast.net \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=stoth@kernellabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.