diff options
Diffstat (limited to 'include/media/v4l2-dev.h')
-rw-r--r-- | include/media/v4l2-dev.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 96d22215cc88..a056e6ee1b68 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -39,6 +39,9 @@ struct v4l2_ctrl_handler; | |||
39 | #define V4L2_FL_USES_V4L2_FH (1) | 39 | #define V4L2_FL_USES_V4L2_FH (1) |
40 | /* Use the prio field of v4l2_fh for core priority checking */ | 40 | /* Use the prio field of v4l2_fh for core priority checking */ |
41 | #define V4L2_FL_USE_FH_PRIO (2) | 41 | #define V4L2_FL_USE_FH_PRIO (2) |
42 | /* If ioctl core locking is in use, then apply that also to all | ||
43 | file operations. Don't use this flag in new drivers! */ | ||
44 | #define V4L2_FL_LOCK_ALL_FOPS (3) | ||
42 | 45 | ||
43 | /* Priority helper functions */ | 46 | /* Priority helper functions */ |
44 | 47 | ||
@@ -126,8 +129,10 @@ struct video_device | |||
126 | 129 | ||
127 | /* ioctl callbacks */ | 130 | /* ioctl callbacks */ |
128 | const struct v4l2_ioctl_ops *ioctl_ops; | 131 | const struct v4l2_ioctl_ops *ioctl_ops; |
132 | DECLARE_BITMAP(valid_ioctls, BASE_VIDIOC_PRIVATE); | ||
129 | 133 | ||
130 | /* serialization lock */ | 134 | /* serialization lock */ |
135 | DECLARE_BITMAP(disable_locking, BASE_VIDIOC_PRIVATE); | ||
131 | struct mutex *lock; | 136 | struct mutex *lock; |
132 | }; | 137 | }; |
133 | 138 | ||
@@ -173,6 +178,26 @@ void video_device_release(struct video_device *vdev); | |||
173 | a dubious construction at best. */ | 178 | a dubious construction at best. */ |
174 | void video_device_release_empty(struct video_device *vdev); | 179 | void video_device_release_empty(struct video_device *vdev); |
175 | 180 | ||
181 | /* returns true if cmd is a known V4L2 ioctl */ | ||
182 | bool v4l2_is_known_ioctl(unsigned int cmd); | ||
183 | |||
184 | /* mark that this command shouldn't use core locking */ | ||
185 | static inline void v4l2_disable_ioctl_locking(struct video_device *vdev, unsigned int cmd) | ||
186 | { | ||
187 | if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE) | ||
188 | set_bit(_IOC_NR(cmd), vdev->disable_locking); | ||
189 | } | ||
190 | |||
191 | /* Mark that this command isn't implemented. This must be called before | ||
192 | video_device_register. See also the comments in determine_valid_ioctls(). | ||
193 | This function allows drivers to provide just one v4l2_ioctl_ops struct, but | ||
194 | disable ioctls based on the specific card that is actually found. */ | ||
195 | static inline void v4l2_disable_ioctl(struct video_device *vdev, unsigned int cmd) | ||
196 | { | ||
197 | if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE) | ||
198 | set_bit(_IOC_NR(cmd), vdev->valid_ioctls); | ||
199 | } | ||
200 | |||
176 | /* helper functions to access driver private data. */ | 201 | /* helper functions to access driver private data. */ |
177 | static inline void *video_get_drvdata(struct video_device *vdev) | 202 | static inline void *video_get_drvdata(struct video_device *vdev) |
178 | { | 203 | { |