aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/v4l2-core/v4l2-dev.c28
-rw-r--r--drivers/media/v4l2-core/v4l2-device.c1
-rw-r--r--include/media/v4l2-dev.h1
-rw-r--r--include/media/v4l2-device.h2
4 files changed, 0 insertions, 32 deletions
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index d89d5cb465d9..9f4538ce09c2 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -357,34 +357,6 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
357 ret = vdev->fops->unlocked_ioctl(filp, cmd, arg); 357 ret = vdev->fops->unlocked_ioctl(filp, cmd, arg);
358 if (lock) 358 if (lock)
359 mutex_unlock(lock); 359 mutex_unlock(lock);
360 } else if (vdev->fops->ioctl) {
361 /* This code path is a replacement for the BKL. It is a major
362 * hack but it will have to do for those drivers that are not
363 * yet converted to use unlocked_ioctl.
364 *
365 * All drivers implement struct v4l2_device, so we use the
366 * lock defined there to serialize the ioctls.
367 *
368 * However, if the driver sleeps, then it blocks all ioctls
369 * since the lock is still held. This is very common for
370 * VIDIOC_DQBUF since that normally waits for a frame to arrive.
371 * As a result any other ioctl calls will proceed very, very
372 * slowly since each call will have to wait for the VIDIOC_QBUF
373 * to finish. Things that should take 0.01s may now take 10-20
374 * seconds.
375 *
376 * The workaround is to *not* take the lock for VIDIOC_DQBUF.
377 * This actually works OK for videobuf-based drivers, since
378 * videobuf will take its own internal lock.
379 */
380 struct mutex *m = &vdev->v4l2_dev->ioctl_lock;
381
382 if (cmd != VIDIOC_DQBUF && mutex_lock_interruptible(m))
383 return -ERESTARTSYS;
384 if (video_is_registered(vdev))
385 ret = vdev->fops->ioctl(filp, cmd, arg);
386 if (cmd != VIDIOC_DQBUF)
387 mutex_unlock(m);
388 } else 360 } else
389 ret = -ENOTTY; 361 ret = -ENOTTY;
390 362
diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
index 204cc67c84e8..5b0a30b9252b 100644
--- a/drivers/media/v4l2-core/v4l2-device.c
+++ b/drivers/media/v4l2-core/v4l2-device.c
@@ -37,7 +37,6 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev)
37 37
38 INIT_LIST_HEAD(&v4l2_dev->subdevs); 38 INIT_LIST_HEAD(&v4l2_dev->subdevs);
39 spin_lock_init(&v4l2_dev->lock); 39 spin_lock_init(&v4l2_dev->lock);
40 mutex_init(&v4l2_dev->ioctl_lock);
41 v4l2_prio_init(&v4l2_dev->prio); 40 v4l2_prio_init(&v4l2_dev->prio);
42 kref_init(&v4l2_dev->ref); 41 kref_init(&v4l2_dev->ref);
43 get_device(dev); 42 get_device(dev);
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 3e4fddfc840c..acbcd2f5fe7f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -65,7 +65,6 @@ struct v4l2_file_operations {
65 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); 65 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
66 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 66 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
67 unsigned int (*poll) (struct file *, struct poll_table_struct *); 67 unsigned int (*poll) (struct file *, struct poll_table_struct *);
68 long (*ioctl) (struct file *, unsigned int, unsigned long);
69 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 68 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
70#ifdef CONFIG_COMPAT 69#ifdef CONFIG_COMPAT
71 long (*compat_ioctl32) (struct file *, unsigned int, unsigned long); 70 long (*compat_ioctl32) (struct file *, unsigned int, unsigned long);
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index ffb69da3ce9e..9c581578783f 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -58,8 +58,6 @@ struct v4l2_device {
58 struct v4l2_ctrl_handler *ctrl_handler; 58 struct v4l2_ctrl_handler *ctrl_handler;
59 /* Device's priority state */ 59 /* Device's priority state */
60 struct v4l2_prio_state prio; 60 struct v4l2_prio_state prio;
61 /* BKL replacement mutex. Temporary solution only. */
62 struct mutex ioctl_lock;
63 /* Keep track of the references to this struct. */ 61 /* Keep track of the references to this struct. */
64 struct kref ref; 62 struct kref ref;
65 /* Release function that is called when the ref count goes to 0. */ 63 /* Release function that is called when the ref count goes to 0. */