diff options
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 6 | ||||
-rw-r--r-- | drivers/media/video/v4l2-device.c | 1 | ||||
-rw-r--r-- | include/media/v4l2-dev.h | 3 | ||||
-rw-r--r-- | include/media/v4l2-device.h | 3 |
4 files changed, 13 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 65d546f35ef4..6b1ef85d8cc8 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -573,6 +573,12 @@ int __video_register_device(struct video_device *vdev, int type, int nr, | |||
573 | vdev->parent = vdev->v4l2_dev->dev; | 573 | vdev->parent = vdev->v4l2_dev->dev; |
574 | if (vdev->ctrl_handler == NULL) | 574 | if (vdev->ctrl_handler == NULL) |
575 | vdev->ctrl_handler = vdev->v4l2_dev->ctrl_handler; | 575 | vdev->ctrl_handler = vdev->v4l2_dev->ctrl_handler; |
576 | /* If the prio state pointer is NULL, and if the driver doesn't | ||
577 | handle priorities itself, then use the v4l2_device prio | ||
578 | state. */ | ||
579 | if (vdev->prio == NULL && vdev->ioctl_ops && | ||
580 | vdev->ioctl_ops->vidioc_s_priority == NULL) | ||
581 | vdev->prio = &vdev->v4l2_dev->prio; | ||
576 | } | 582 | } |
577 | 583 | ||
578 | /* Part 2: find a free minor, device node number and device index. */ | 584 | /* Part 2: find a free minor, device node number and device index. */ |
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index a1afda352d08..fd7a445ce34c 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c | |||
@@ -36,6 +36,7 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev) | |||
36 | INIT_LIST_HEAD(&v4l2_dev->subdevs); | 36 | INIT_LIST_HEAD(&v4l2_dev->subdevs); |
37 | spin_lock_init(&v4l2_dev->lock); | 37 | spin_lock_init(&v4l2_dev->lock); |
38 | mutex_init(&v4l2_dev->ioctl_lock); | 38 | mutex_init(&v4l2_dev->ioctl_lock); |
39 | v4l2_prio_init(&v4l2_dev->prio); | ||
39 | v4l2_dev->dev = dev; | 40 | v4l2_dev->dev = dev; |
40 | if (dev == NULL) { | 41 | if (dev == NULL) { |
41 | /* If dev == NULL, then name must be filled in by the caller */ | 42 | /* If dev == NULL, then name must be filled in by the caller */ |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 9193703f4f0f..3700127ba299 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -89,6 +89,9 @@ struct video_device | |||
89 | /* Control handler associated with this device node. May be NULL. */ | 89 | /* Control handler associated with this device node. May be NULL. */ |
90 | struct v4l2_ctrl_handler *ctrl_handler; | 90 | struct v4l2_ctrl_handler *ctrl_handler; |
91 | 91 | ||
92 | /* Priority state. If NULL, then v4l2_dev->prio will be used. */ | ||
93 | struct v4l2_prio_state *prio; | ||
94 | |||
92 | /* device info */ | 95 | /* device info */ |
93 | char name[32]; | 96 | char name[32]; |
94 | int vfl_type; | 97 | int vfl_type; |
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index 0c2bd3075038..3b723283da26 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <media/media-device.h> | 24 | #include <media/media-device.h> |
25 | #include <media/v4l2-subdev.h> | 25 | #include <media/v4l2-subdev.h> |
26 | #include <media/v4l2-dev.h> | ||
26 | 27 | ||
27 | /* Each instance of a V4L2 device should create the v4l2_device struct, | 28 | /* Each instance of a V4L2 device should create the v4l2_device struct, |
28 | either stand-alone or embedded in a larger struct. | 29 | either stand-alone or embedded in a larger struct. |
@@ -55,6 +56,8 @@ struct v4l2_device { | |||
55 | unsigned int notification, void *arg); | 56 | unsigned int notification, void *arg); |
56 | /* The control handler. May be NULL. */ | 57 | /* The control handler. May be NULL. */ |
57 | struct v4l2_ctrl_handler *ctrl_handler; | 58 | struct v4l2_ctrl_handler *ctrl_handler; |
59 | /* Device's priority state */ | ||
60 | struct v4l2_prio_state prio; | ||
58 | /* BKL replacement mutex. Temporary solution only. */ | 61 | /* BKL replacement mutex. Temporary solution only. */ |
59 | struct mutex ioctl_lock; | 62 | struct mutex ioctl_lock; |
60 | }; | 63 | }; |