Skip to content

Commit

Permalink
[media] v4l2-dev: rename two functions
Browse files Browse the repository at this point in the history
Rename the function v4l2_dont_use_lock to v4l2_disable_ioctl_locking,
and rename v4l2_dont_use_cmd to v4l2_disable_ioctl.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed May 14, 2012
1 parent 47bd4bc commit 152a3a7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Documentation/video4linux/v4l2-framework.txt
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ In some cases you want to tell the core that a function you had specified in
your v4l2_ioctl_ops should be ignored. You can mark such ioctls by calling this
function before video_device_register is called:

void v4l2_dont_use_cmd(struct video_device *vdev, unsigned int cmd);
void v4l2_disable_ioctl(struct video_device *vdev, unsigned int cmd);

This tends to be needed if based on external factors (e.g. which card is
being used) you want to turns off certain features in v4l2_ioctl_ops without
Expand Down Expand Up @@ -655,9 +655,9 @@ will be either a top-level mutex or a mutex per device node. By default this
lock will be used for unlocked_ioctl, but you can disable locking for
selected ioctls by calling:

void v4l2_dont_use_lock(struct video_device *vdev, unsigned int cmd);
void v4l2_disable_ioctl_locking(struct video_device *vdev, unsigned int cmd);

E.g.: v4l2_dont_use_lock(vdev, VIDIOC_DQBUF);
E.g.: v4l2_disable_ioctl_locking(vdev, VIDIOC_DQBUF);

You have to call this before you register the video_device.

Expand Down
6 changes: 3 additions & 3 deletions drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -2285,9 +2285,9 @@ int gspca_dev_probe2(struct usb_interface *intf,
* usb_lock is taken for a long time, e.g. when changing a control
* value, and a new frame is ready to be dequeued.
*/
v4l2_dont_use_lock(&gspca_dev->vdev, VIDIOC_DQBUF);
v4l2_dont_use_lock(&gspca_dev->vdev, VIDIOC_QBUF);
v4l2_dont_use_lock(&gspca_dev->vdev, VIDIOC_QUERYBUF);
v4l2_disable_ioctl_locking(&gspca_dev->vdev, VIDIOC_DQBUF);
v4l2_disable_ioctl_locking(&gspca_dev->vdev, VIDIOC_QBUF);
v4l2_disable_ioctl_locking(&gspca_dev->vdev, VIDIOC_QUERYBUF);

/* init video stuff */
ret = video_register_device(&gspca_dev->vdev,
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/video/pwc/pwc-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,9 +1195,9 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
* v4l2_lock is taken for a long time, e.g. when changing a control
* value, and a new frame is ready to be dequeued.
*/
v4l2_dont_use_lock(&pdev->vdev, VIDIOC_DQBUF);
v4l2_dont_use_lock(&pdev->vdev, VIDIOC_QBUF);
v4l2_dont_use_lock(&pdev->vdev, VIDIOC_QUERYBUF);
v4l2_disable_ioctl_locking(&pdev->vdev, VIDIOC_DQBUF);
v4l2_disable_ioctl_locking(&pdev->vdev, VIDIOC_QBUF);
v4l2_disable_ioctl_locking(&pdev->vdev, VIDIOC_QUERYBUF);

rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, -1);
if (rc < 0) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/v4l2-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (vdev->lock) {
/* always lock unless the cmd is marked as "don't use lock" */
locked = !v4l2_is_known_ioctl(cmd) ||
!test_bit(_IOC_NR(cmd), vdev->dont_use_lock);
!test_bit(_IOC_NR(cmd), vdev->disable_locking);

if (locked && mutex_lock_interruptible(vdev->lock))
return -ERESTARTSYS;
Expand Down
10 changes: 5 additions & 5 deletions include/media/v4l2-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ struct video_device
DECLARE_BITMAP(valid_ioctls, BASE_VIDIOC_PRIVATE);

/* serialization lock */
DECLARE_BITMAP(dont_use_lock, BASE_VIDIOC_PRIVATE);
DECLARE_BITMAP(disable_locking, BASE_VIDIOC_PRIVATE);
struct mutex *lock;
};

Expand Down Expand Up @@ -182,17 +182,17 @@ void video_device_release_empty(struct video_device *vdev);
bool v4l2_is_known_ioctl(unsigned int cmd);

/* mark that this command shouldn't use core locking */
static inline void v4l2_dont_use_lock(struct video_device *vdev, unsigned int cmd)
static inline void v4l2_disable_ioctl_locking(struct video_device *vdev, unsigned int cmd)
{
if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE)
set_bit(_IOC_NR(cmd), vdev->dont_use_lock);
set_bit(_IOC_NR(cmd), vdev->disable_locking);
}

/* Mark that this command isn't implemented, must be called before
/* Mark that this command isn't implemented. This must be called before
video_device_register. See also the comments in determine_valid_ioctls().
This function allows drivers to provide just one v4l2_ioctl_ops struct, but
disable ioctls based on the specific card that is actually found. */
static inline void v4l2_dont_use_cmd(struct video_device *vdev, unsigned int cmd)
static inline void v4l2_disable_ioctl(struct video_device *vdev, unsigned int cmd)
{
if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE)
set_bit(_IOC_NR(cmd), vdev->valid_ioctls);
Expand Down
2 changes: 1 addition & 1 deletion sound/i2c/other/tea575x-tuner.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ int snd_tea575x_init(struct snd_tea575x *tea)
set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags);
/* disable hw_freq_seek if we can't use it */
if (tea->cannot_read_data)
v4l2_dont_use_cmd(&tea->vd, VIDIOC_S_HW_FREQ_SEEK);
v4l2_disable_ioctl(&tea->vd, VIDIOC_S_HW_FREQ_SEEK);

v4l2_ctrl_handler_init(&tea->ctrl_handler, 1);
v4l2_ctrl_new_std(&tea->ctrl_handler, &tea575x_ctrl_ops, V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
Expand Down

0 comments on commit 152a3a7

Please sign in to comment.