Skip to content

Commit

Permalink
Merge branch 'media_fixes' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/mchehab/linux-2.6

* 'media_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (101 commits)
  [media] staging/lirc: fix mem leaks and ptr err usage
  [media] hdpvr: reduce latency of i2c read/write w/recycled buffer
  [media] hdpvr: enable IR part
  [media] rc/mceusb: timeout should be in ns, not us
  [media] v4l2-device: fix 'use-after-freed' oops
  [media] v4l2-dev: don't memset video_device.dev
  [media] zoran: use video_device_alloc instead of kmalloc
  [media] w9966: zero device state after a detach
  [media] v4l: Fix a use-before-set in the control framework
  [media] v4l: Include linux/videodev2.h in media/v4l2-ctrls.h
  [media] DocBook/v4l: update V4L2 revision and update copyright years
  [media] DocBook/v4l: fix validation error in dev-rds.xml
  [media] v4l2-ctrls: queryctrl shouldn't attempt to replace V4L2_CID_PRIVATE_BASE IDs
  [media] v4l2-ctrls: fix missing 'read-only' check
  [media] pvrusb2: Provide more information about IR units to lirc_zilog and ir-kbd-i2c
  [media] ir-kbd-i2c: Add back defaults setting for Zilog Z8's at addr 0x71
  [media] lirc_zilog: Update TODO.lirc_zilog
  [media] lirc_zilog: Add Andy Walls to copyright notice and authors list
  [media] lirc_zilog: Remove useless struct i2c_driver.command function
  [media] lirc_zilog: Remove unneeded tests for existence of the IR Tx function
  ...
  • Loading branch information
torvalds committed Jan 22, 2011
2 parents 973c9f4 + 88914bd commit 13a3cec
Show file tree
Hide file tree
Showing 133 changed files with 2,442 additions and 2,661 deletions.
2 changes: 1 addition & 1 deletion Documentation/DocBook/dvb/dvbapi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<holder>Convergence GmbH</holder>
</copyright>
<copyright>
<year>2009-2010</year>
<year>2009-2011</year>
<holder>Mauro Carvalho Chehab</holder>
</copyright>

Expand Down
4 changes: 2 additions & 2 deletions Documentation/DocBook/media.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<title>LINUX MEDIA INFRASTRUCTURE API</title>

<copyright>
<year>2009-2010</year>
<year>2009-2011</year>
<holder>LinuxTV Developers</holder>
</copyright>

Expand Down Expand Up @@ -86,7 +86,7 @@ Foundation. A copy of the license is included in the chapter entitled
</author>
</authorgroup>
<copyright>
<year>2009-2010</year>
<year>2009-2011</year>
<holder>Mauro Carvalho Chehab</holder>
</copyright>

Expand Down
6 changes: 4 additions & 2 deletions Documentation/DocBook/v4l/dev-rds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ as follows:</para>
</section>

<section>
<title>RDS datastructures</title>
<table frame="none" pgwide="1" id="v4l2-rds-data">
<title>struct
<structname>v4l2_rds_data</structname></title>
Expand Down Expand Up @@ -129,10 +130,11 @@ as follows:</para>

<table frame="none" pgwide="1" id="v4l2-rds-block-codes">
<title>Block defines</title>
<tgroup cols="3">
<tgroup cols="4">
<colspec colname="c1" colwidth="1*" />
<colspec colname="c2" colwidth="1*" />
<colspec colname="c3" colwidth="5*" />
<colspec colname="c3" colwidth="1*" />
<colspec colname="c4" colwidth="5*" />
<tbody valign="top">
<row>
<entry>V4L2_RDS_BLOCK_MSK</entry>
Expand Down
3 changes: 2 additions & 1 deletion Documentation/DocBook/v4l/v4l2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Remote Controller chapter.</contrib>
<year>2008</year>
<year>2009</year>
<year>2010</year>
<year>2011</year>
<holder>Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin
Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab</holder>
</copyright>
Expand Down Expand Up @@ -381,7 +382,7 @@ and discussions on the V4L mailing list.</revremark>
</partinfo>

<title>Video for Linux Two API Specification</title>
<subtitle>Revision 2.6.33</subtitle>
<subtitle>Revision 2.6.38</subtitle>

<chapter id="common">
&sub-common;
Expand Down
12 changes: 12 additions & 0 deletions Documentation/video4linux/v4l2-controls.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ implement g_volatile_ctrl like this:
The 'new value' union is not used in g_volatile_ctrl. In general controls
that need to implement g_volatile_ctrl are read-only controls.

Note that if one or more controls in a control cluster are marked as volatile,
then all the controls in the cluster are seen as volatile.

To mark a control as volatile you have to set the is_volatile flag:

ctrl = v4l2_ctrl_new_std(&sd->ctrl_handler, ...);
Expand Down Expand Up @@ -462,6 +465,15 @@ pointer to the v4l2_ctrl_ops struct that is used for that cluster.
Obviously, all controls in the cluster array must be initialized to either
a valid control or to NULL.

In rare cases you might want to know which controls of a cluster actually
were set explicitly by the user. For this you can check the 'is_new' flag of
each control. For example, in the case of a volume/mute cluster the 'is_new'
flag of the mute control would be set if the user called VIDIOC_S_CTRL for
mute only. If the user would call VIDIOC_S_EXT_CTRLS for both mute and volume
controls, then the 'is_new' flag would be 1 for both controls.

The 'is_new' flag is always 1 when called from v4l2_ctrl_handler_setup().


VIDIOC_LOG_STATUS Support
=========================
Expand Down
2 changes: 1 addition & 1 deletion 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 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 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 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
Loading

0 comments on commit 13a3cec

Please sign in to comment.