[media] v4l2-dev: rename two functions
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>
This commit is contained in:
parent
47bd4bc1a2
commit
152a3a7320
6 changed files with 16 additions and 16 deletions
|
@ -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
|
your v4l2_ioctl_ops should be ignored. You can mark such ioctls by calling this
|
||||||
function before video_device_register is called:
|
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
|
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
|
being used) you want to turns off certain features in v4l2_ioctl_ops without
|
||||||
|
@ -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
|
lock will be used for unlocked_ioctl, but you can disable locking for
|
||||||
selected ioctls by calling:
|
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.
|
You have to call this before you register the video_device.
|
||||||
|
|
||||||
|
|
|
@ -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
|
* usb_lock is taken for a long time, e.g. when changing a control
|
||||||
* value, and a new frame is ready to be dequeued.
|
* value, and a new frame is ready to be dequeued.
|
||||||
*/
|
*/
|
||||||
v4l2_dont_use_lock(&gspca_dev->vdev, VIDIOC_DQBUF);
|
v4l2_disable_ioctl_locking(&gspca_dev->vdev, VIDIOC_DQBUF);
|
||||||
v4l2_dont_use_lock(&gspca_dev->vdev, VIDIOC_QBUF);
|
v4l2_disable_ioctl_locking(&gspca_dev->vdev, VIDIOC_QBUF);
|
||||||
v4l2_dont_use_lock(&gspca_dev->vdev, VIDIOC_QUERYBUF);
|
v4l2_disable_ioctl_locking(&gspca_dev->vdev, VIDIOC_QUERYBUF);
|
||||||
|
|
||||||
/* init video stuff */
|
/* init video stuff */
|
||||||
ret = video_register_device(&gspca_dev->vdev,
|
ret = video_register_device(&gspca_dev->vdev,
|
||||||
|
|
|
@ -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
|
* v4l2_lock is taken for a long time, e.g. when changing a control
|
||||||
* value, and a new frame is ready to be dequeued.
|
* value, and a new frame is ready to be dequeued.
|
||||||
*/
|
*/
|
||||||
v4l2_dont_use_lock(&pdev->vdev, VIDIOC_DQBUF);
|
v4l2_disable_ioctl_locking(&pdev->vdev, VIDIOC_DQBUF);
|
||||||
v4l2_dont_use_lock(&pdev->vdev, VIDIOC_QBUF);
|
v4l2_disable_ioctl_locking(&pdev->vdev, VIDIOC_QBUF);
|
||||||
v4l2_dont_use_lock(&pdev->vdev, VIDIOC_QUERYBUF);
|
v4l2_disable_ioctl_locking(&pdev->vdev, VIDIOC_QUERYBUF);
|
||||||
|
|
||||||
rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, -1);
|
rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, -1);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
|
|
@ -329,7 +329,7 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||||
if (vdev->lock) {
|
if (vdev->lock) {
|
||||||
/* always lock unless the cmd is marked as "don't use lock" */
|
/* always lock unless the cmd is marked as "don't use lock" */
|
||||||
locked = !v4l2_is_known_ioctl(cmd) ||
|
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))
|
if (locked && mutex_lock_interruptible(vdev->lock))
|
||||||
return -ERESTARTSYS;
|
return -ERESTARTSYS;
|
||||||
|
|
|
@ -132,7 +132,7 @@ struct video_device
|
||||||
DECLARE_BITMAP(valid_ioctls, BASE_VIDIOC_PRIVATE);
|
DECLARE_BITMAP(valid_ioctls, BASE_VIDIOC_PRIVATE);
|
||||||
|
|
||||||
/* serialization lock */
|
/* serialization lock */
|
||||||
DECLARE_BITMAP(dont_use_lock, BASE_VIDIOC_PRIVATE);
|
DECLARE_BITMAP(disable_locking, BASE_VIDIOC_PRIVATE);
|
||||||
struct mutex *lock;
|
struct mutex *lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -182,17 +182,17 @@ void video_device_release_empty(struct video_device *vdev);
|
||||||
bool v4l2_is_known_ioctl(unsigned int cmd);
|
bool v4l2_is_known_ioctl(unsigned int cmd);
|
||||||
|
|
||||||
/* mark that this command shouldn't use core locking */
|
/* 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)
|
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().
|
video_device_register. See also the comments in determine_valid_ioctls().
|
||||||
This function allows drivers to provide just one v4l2_ioctl_ops struct, but
|
This function allows drivers to provide just one v4l2_ioctl_ops struct, but
|
||||||
disable ioctls based on the specific card that is actually found. */
|
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)
|
if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE)
|
||||||
set_bit(_IOC_NR(cmd), vdev->valid_ioctls);
|
set_bit(_IOC_NR(cmd), vdev->valid_ioctls);
|
||||||
|
|
|
@ -377,7 +377,7 @@ int snd_tea575x_init(struct snd_tea575x *tea)
|
||||||
set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags);
|
set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags);
|
||||||
/* disable hw_freq_seek if we can't use it */
|
/* disable hw_freq_seek if we can't use it */
|
||||||
if (tea->cannot_read_data)
|
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_handler_init(&tea->ctrl_handler, 1);
|
||||||
v4l2_ctrl_new_std(&tea->ctrl_handler, &tea575x_ctrl_ops, V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
|
v4l2_ctrl_new_std(&tea->ctrl_handler, &tea575x_ctrl_ops, V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
|
||||||
|
|
Loading…
Reference in a new issue