]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[media] v4l2: add v4l2_prio_state to v4l2_device and video_device
authorHans Verkuil <hverkuil@xs4all.nl>
Thu, 24 Feb 2011 13:42:24 +0000 (10:42 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 22 Mar 2011 19:37:55 +0000 (16:37 -0300)
Integrate the v4l2_prio_state into the core, ready for use.

One struct v4l2_prio_state is added to v4l2_device and a pointer
to a prio state is added to video_device.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-dev.c
drivers/media/video/v4l2-device.c
include/media/v4l2-dev.h
include/media/v4l2-device.h

index 65d546f35ef4f21725d0a46d2d473f91cc2fbc75..6b1ef85d8cc827b10a764d60d93b59d8fd2edd31 100644 (file)
@@ -573,6 +573,12 @@ int __video_register_device(struct video_device *vdev, int type, int nr,
                        vdev->parent = vdev->v4l2_dev->dev;
                if (vdev->ctrl_handler == NULL)
                        vdev->ctrl_handler = vdev->v4l2_dev->ctrl_handler;
+               /* If the prio state pointer is NULL, and if the driver doesn't
+                  handle priorities itself, then use the v4l2_device prio
+                  state. */
+               if (vdev->prio == NULL && vdev->ioctl_ops &&
+                               vdev->ioctl_ops->vidioc_s_priority == NULL)
+                       vdev->prio = &vdev->v4l2_dev->prio;
        }
 
        /* Part 2: find a free minor, device node number and device index. */
index a1afda352d0886b9c89307d194f098c6331c7364..fd7a445ce34cec5bdea6dd737763453cd1a3f9ec 100644 (file)
@@ -36,6 +36,7 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev)
        INIT_LIST_HEAD(&v4l2_dev->subdevs);
        spin_lock_init(&v4l2_dev->lock);
        mutex_init(&v4l2_dev->ioctl_lock);
+       v4l2_prio_init(&v4l2_dev->prio);
        v4l2_dev->dev = dev;
        if (dev == NULL) {
                /* If dev == NULL, then name must be filled in by the caller */
index 9193703f4f0fbc182e81d5dbdb41a45e0d29dc47..3700127ba29928699587703a3eeb9e8f5dcbb222 100644 (file)
@@ -89,6 +89,9 @@ struct video_device
        /* Control handler associated with this device node. May be NULL. */
        struct v4l2_ctrl_handler *ctrl_handler;
 
+       /* Priority state. If NULL, then v4l2_dev->prio will be used. */
+       struct v4l2_prio_state *prio;
+
        /* device info */
        char name[32];
        int vfl_type;
index 0c2bd30750386eda1274112d5b68bb0638b95da7..3b723283da263478b1af2b0657e200bed58976d1 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <media/media-device.h>
 #include <media/v4l2-subdev.h>
+#include <media/v4l2-dev.h>
 
 /* Each instance of a V4L2 device should create the v4l2_device struct,
    either stand-alone or embedded in a larger struct.
@@ -55,6 +56,8 @@ struct v4l2_device {
                        unsigned int notification, void *arg);
        /* The control handler. May be NULL. */
        struct v4l2_ctrl_handler *ctrl_handler;
+       /* Device's priority state */
+       struct v4l2_prio_state prio;
        /* BKL replacement mutex. Temporary solution only. */
        struct mutex ioctl_lock;
 };