Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 152a3a73 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 47bd4bc1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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
@@ -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.

+3 −3
Original line number Diff line number Diff line
@@ -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,
+3 −3
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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;
+5 −5
Original line number Diff line number Diff line
@@ -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;
};

@@ -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);
Loading