Skip to content

Commit

Permalink
V4L/DVB: soc-camera: allow only one video queue per device
Browse files Browse the repository at this point in the history
Multiple user-space application instances can open the same video device, but
it only makes sense for one of them to manage the videobuffer queue and set
video format of the device. Restrict soc-camera respectively.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Guennadi Liakhovetski authored and Mauro Carvalho Chehab committed Oct 21, 2010
1 parent 79c6ff9 commit 57bee29
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 110 deletions.
8 changes: 4 additions & 4 deletions drivers/media/video/mx1_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ static int mx1_camera_try_fmt(struct soc_camera_device *icd,
return 0;
}

static int mx1_camera_reqbufs(struct soc_camera_file *icf,
static int mx1_camera_reqbufs(struct soc_camera_device *icd,
struct v4l2_requestbuffers *p)
{
int i;
Expand All @@ -650,7 +650,7 @@ static int mx1_camera_reqbufs(struct soc_camera_file *icf,
* it hadn't triggered
*/
for (i = 0; i < p->count; i++) {
struct mx1_buffer *buf = container_of(icf->vb_vidq.bufs[i],
struct mx1_buffer *buf = container_of(icd->vb_vidq.bufs[i],
struct mx1_buffer, vb);
buf->inwork = 0;
INIT_LIST_HEAD(&buf->vb.queue);
Expand All @@ -661,10 +661,10 @@ static int mx1_camera_reqbufs(struct soc_camera_file *icf,

static unsigned int mx1_camera_poll(struct file *file, poll_table *pt)
{
struct soc_camera_file *icf = file->private_data;
struct soc_camera_device *icd = file->private_data;
struct mx1_buffer *buf;

buf = list_entry(icf->vb_vidq.stream.next, struct mx1_buffer,
buf = list_entry(icd->vb_vidq.stream.next, struct mx1_buffer,
vb.stream);

poll_wait(file, &buf->vb.done, pt);
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/video/mx3_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,17 +976,17 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd,
return ret;
}

static int mx3_camera_reqbufs(struct soc_camera_file *icf,
static int mx3_camera_reqbufs(struct soc_camera_device *icd,
struct v4l2_requestbuffers *p)
{
return 0;
}

static unsigned int mx3_camera_poll(struct file *file, poll_table *pt)
{
struct soc_camera_file *icf = file->private_data;
struct soc_camera_device *icd = file->private_data;

return videobuf_poll_stream(file, &icf->vb_vidq, pt);
return videobuf_poll_stream(file, &icd->vb_vidq, pt);
}

static int mx3_camera_querycap(struct soc_camera_host *ici,
Expand Down
8 changes: 4 additions & 4 deletions drivers/media/video/pxa_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
return ret;
}

static int pxa_camera_reqbufs(struct soc_camera_file *icf,
static int pxa_camera_reqbufs(struct soc_camera_device *icd,
struct v4l2_requestbuffers *p)
{
int i;
Expand All @@ -1551,7 +1551,7 @@ static int pxa_camera_reqbufs(struct soc_camera_file *icf,
* it hadn't triggered
*/
for (i = 0; i < p->count; i++) {
struct pxa_buffer *buf = container_of(icf->vb_vidq.bufs[i],
struct pxa_buffer *buf = container_of(icd->vb_vidq.bufs[i],
struct pxa_buffer, vb);
buf->inwork = 0;
INIT_LIST_HEAD(&buf->vb.queue);
Expand All @@ -1562,10 +1562,10 @@ static int pxa_camera_reqbufs(struct soc_camera_file *icf,

static unsigned int pxa_camera_poll(struct file *file, poll_table *pt)
{
struct soc_camera_file *icf = file->private_data;
struct soc_camera_device *icd = file->private_data;
struct pxa_buffer *buf;

buf = list_entry(icf->vb_vidq.stream.next, struct pxa_buffer,
buf = list_entry(icd->vb_vidq.stream.next, struct pxa_buffer,
vb.stream);

poll_wait(file, &buf->vb.done, pt);
Expand Down
8 changes: 4 additions & 4 deletions drivers/media/video/sh_mobile_ceu_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
return ret;
}

static int sh_mobile_ceu_reqbufs(struct soc_camera_file *icf,
static int sh_mobile_ceu_reqbufs(struct soc_camera_device *icd,
struct v4l2_requestbuffers *p)
{
int i;
Expand All @@ -1740,7 +1740,7 @@ static int sh_mobile_ceu_reqbufs(struct soc_camera_file *icf,
for (i = 0; i < p->count; i++) {
struct sh_mobile_ceu_buffer *buf;

buf = container_of(icf->vb_vidq.bufs[i],
buf = container_of(icd->vb_vidq.bufs[i],
struct sh_mobile_ceu_buffer, vb);
INIT_LIST_HEAD(&buf->vb.queue);
}
Expand All @@ -1750,10 +1750,10 @@ static int sh_mobile_ceu_reqbufs(struct soc_camera_file *icf,

static unsigned int sh_mobile_ceu_poll(struct file *file, poll_table *pt)
{
struct soc_camera_file *icf = file->private_data;
struct soc_camera_device *icd = file->private_data;
struct sh_mobile_ceu_buffer *buf;

buf = list_entry(icf->vb_vidq.stream.next,
buf = list_entry(icd->vb_vidq.stream.next,
struct sh_mobile_ceu_buffer, vb.stream);

poll_wait(file, &buf->vb.done, pt);
Expand Down
Loading

0 comments on commit 57bee29

Please sign in to comment.