]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/media/v4l2-dev.h
Merge remote-tracking branch 'rostedt/tip/perf/urgent-2' into x86-urgent-for-linus
[karo-tx-linux.git] / include / media / v4l2-dev.h
index d00b9d3511f29be111ace1f5b33e83020166e595..a056e6ee1b6820c05d87ae6e178cc0a6008dc814 100644 (file)
@@ -39,6 +39,9 @@ struct v4l2_ctrl_handler;
 #define V4L2_FL_USES_V4L2_FH   (1)
 /* Use the prio field of v4l2_fh for core priority checking */
 #define V4L2_FL_USE_FH_PRIO    (2)
+/* If ioctl core locking is in use, then apply that also to all
+   file operations. Don't use this flag in new drivers! */
+#define V4L2_FL_LOCK_ALL_FOPS  (3)
 
 /* Priority helper functions */
 
@@ -126,9 +129,10 @@ struct video_device
 
        /* ioctl callbacks */
        const struct v4l2_ioctl_ops *ioctl_ops;
+       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;
 };
 
@@ -178,10 +182,20 @@ 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. 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_disable_ioctl(struct video_device *vdev, unsigned int cmd)
+{
+       if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE)
+               set_bit(_IOC_NR(cmd), vdev->valid_ioctls);
 }
 
 /* helper functions to access driver private data. */