Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232158
b: refs/heads/master
c: 9af3971
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jan 19, 2011
1 parent 435f1b9 commit f49ce6c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b219ab9cfb2057de6e779169197f83265c310c83
refs/heads/master: 9af39713feb53da96ba23fa94a73ffd0de50a815
2 changes: 1 addition & 1 deletion trunk/drivers/media/common/saa7146_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
INFO(("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x).\n", dev->mem, dev->revision, pci->irq, pci->subsystem_vendor, pci->subsystem_device));
dev->ext = ext;

mutex_init(&dev->lock);
mutex_init(&dev->v4l2_lock);
spin_lock_init(&dev->int_slock);
spin_lock_init(&dev->slock);

Expand Down
8 changes: 2 additions & 6 deletions trunk/drivers/media/common/saa7146_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit)
}

/* is it free? */
mutex_lock(&dev->lock);
if (vv->resources & bit) {
DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit));
/* no, someone else uses it */
mutex_unlock(&dev->lock);
return 0;
}
/* it's free, grab it */
fh->resources |= bit;
vv->resources |= bit;
DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources));
mutex_unlock(&dev->lock);
return 1;
}

Expand All @@ -37,11 +34,9 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits)

BUG_ON((fh->resources & bits) != bits);

mutex_lock(&dev->lock);
fh->resources &= ~bits;
vv->resources &= ~bits;
DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources));
mutex_unlock(&dev->lock);
}


Expand Down Expand Up @@ -396,7 +391,7 @@ static const struct v4l2_file_operations video_fops =
.write = fops_write,
.poll = fops_poll,
.mmap = fops_mmap,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static void vv_callback(struct saa7146_dev *dev, unsigned long status)
Expand Down Expand Up @@ -505,6 +500,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
vfd->fops = &video_fops;
vfd->ioctl_ops = &dev->ext_vv_data->ops;
vfd->release = video_device_release;
vfd->lock = &dev->v4l2_lock;
vfd->tvnorms = 0;
for (i = 0; i < dev->ext_vv_data->num_stds; i++)
vfd->tvnorms |= dev->ext_vv_data->stds[i].id;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/common/saa7146_vbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
V4L2_BUF_TYPE_VBI_CAPTURE,
V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
sizeof(struct saa7146_buf),
file, NULL);
file, &dev->v4l2_lock);

init_timer(&fh->vbi_read_timeout);
fh->vbi_read_timeout.function = vbi_read_timeout;
Expand Down
20 changes: 1 addition & 19 deletions trunk/drivers/media/common/saa7146_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
}
}

mutex_lock(&dev->lock);

/* ok, accept it */
vv->ov_fb = *fb;
vv->ov_fmt = fmt;
Expand All @@ -563,8 +561,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8;
DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline));
}

mutex_unlock(&dev->lock);
return 0;
}

Expand Down Expand Up @@ -649,8 +645,6 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
return -EINVAL;
}

mutex_lock(&dev->lock);

switch (ctrl->type) {
case V4L2_CTRL_TYPE_BOOLEAN:
case V4L2_CTRL_TYPE_MENU:
Expand Down Expand Up @@ -693,24 +687,20 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
/* fixme: we can support changing VFLIP and HFLIP here... */
if (IS_CAPTURE_ACTIVE(fh) != 0) {
DEB_D(("V4L2_CID_HFLIP while active capture.\n"));
mutex_unlock(&dev->lock);
return -EBUSY;
}
vv->hflip = c->value;
break;
case V4L2_CID_VFLIP:
if (IS_CAPTURE_ACTIVE(fh) != 0) {
DEB_D(("V4L2_CID_VFLIP while active capture.\n"));
mutex_unlock(&dev->lock);
return -EBUSY;
}
vv->vflip = c->value;
break;
default:
mutex_unlock(&dev->lock);
return -EINVAL;
}
mutex_unlock(&dev->lock);

if (IS_OVERLAY_ACTIVE(fh) != 0) {
saa7146_stop_preview(fh);
Expand Down Expand Up @@ -902,22 +892,18 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_f
err = vidioc_try_fmt_vid_overlay(file, fh, f);
if (0 != err)
return err;
mutex_lock(&dev->lock);
fh->ov.win = f->fmt.win;
fh->ov.nclips = f->fmt.win.clipcount;
if (fh->ov.nclips > 16)
fh->ov.nclips = 16;
if (copy_from_user(fh->ov.clips, f->fmt.win.clips,
sizeof(struct v4l2_clip) * fh->ov.nclips)) {
mutex_unlock(&dev->lock);
return -EFAULT;
}

/* fh->ov.fh is used to indicate that we have valid overlay informations, too */
fh->ov.fh = fh;

mutex_unlock(&dev->lock);

/* check if our current overlay is active */
if (IS_OVERLAY_ACTIVE(fh) != 0) {
saa7146_stop_preview(fh);
Expand Down Expand Up @@ -976,8 +962,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
}
}

mutex_lock(&dev->lock);

for (i = 0; i < dev->ext_vv_data->num_stds; i++)
if (*id & dev->ext_vv_data->stds[i].id)
break;
Expand All @@ -988,8 +972,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
found = 1;
}

mutex_unlock(&dev->lock);

if (vv->ov_suspend != NULL) {
saa7146_start_preview(vv->ov_suspend);
vv->ov_suspend = NULL;
Expand Down Expand Up @@ -1354,7 +1336,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_INTERLACED,
sizeof(struct saa7146_buf),
file, NULL);
file, &dev->v4l2_lock);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/media/saa7146.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct saa7146_dev

/* different device locks */
spinlock_t slock;
struct mutex lock;
struct mutex v4l2_lock;

unsigned char __iomem *mem; /* pointer to mapped IO memory */
u32 revision; /* chip revision; needed for bug-workarounds*/
Expand Down

0 comments on commit f49ce6c

Please sign in to comment.