[PATCH 1/5] v4l: Pushdown bkl into video_ioctl2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



video_ioctl2 is a generic ioctl helper used by a lot of drivers.
Most of them put it as their bkl'ed .ioctl callback, then let's
pushdown the bkl inside but also provide an unlocked version for
those that use it as an unlocked ioctl.

Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
---
 drivers/media/video/v4l2-ioctl.c |   17 +++++++++++++++--
 include/media/v4l2-ioctl.h       |    2 ++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 3da8d8f..0ff2595 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/smp_lock.h>
 
 #define __OLD_VIDIOC_ /* To allow fixing old calls */
 #include <linux/videodev.h>
@@ -2007,8 +2008,8 @@ static unsigned long cmd_input_size(unsigned int cmd)
 	}
 }
 
-long video_ioctl2(struct file *file,
-	       unsigned int cmd, unsigned long arg)
+long video_ioctl2_unlocked(struct file *file,
+			   unsigned int cmd, unsigned long arg)
 {
 	char	sbuf[128];
 	void    *mbuf = NULL;
@@ -2102,4 +2103,16 @@ out:
 	kfree(mbuf);
 	return err;
 }
+EXPORT_SYMBOL(video_ioctl2_unlocked);
+
+long video_ioctl2(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	long ret;
+
+	lock_kernel();
+	ret = video_ioctl2_unlocked(file, cmd, arg);
+	unlock_kernel();
+
+	return ret;
+}
 EXPORT_SYMBOL(video_ioctl2);
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e8ba0f2..08b3e42 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -316,5 +316,7 @@ extern long video_usercopy(struct file *file, unsigned int cmd,
 /* Standard handlers for V4L ioctl's */
 extern long video_ioctl2(struct file *file,
 			unsigned int cmd, unsigned long arg);
+extern long video_ioctl2_unlocked(struct file *file,
+				  unsigned int cmd, unsigned long arg);
 
 #endif /* _V4L2_IOCTL_H */
-- 
1.6.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux