The patch number 9974 was added via Hans Verkuil <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [email protected]

------

From: Hans Verkuil  <[email protected]>
v4l2-dev: allow drivers to pass v4l2_device as parent


Drivers that use v4l2_device can set that as parent pointer in the v4l2_dev
field instead of using the struct device parent field.

This allows v4l2-dev.c to check whether this driver is v4l2_device based,
and if so then it can offer additional services.

Priority: normal

Signed-off-by: Hans Verkuil <[email protected]>


---

 linux/drivers/media/video/v4l2-dev.c |    3 +++
 linux/include/media/v4l2-dev.h       |    4 ++++
 2 files changed, 7 insertions(+)

diff -r 00b5856d3ee5 -r ceda70954ad6 linux/drivers/media/video/v4l2-dev.c
--- a/linux/drivers/media/video/v4l2-dev.c      Sat Dec 20 01:28:27 2008 +0100
+++ b/linux/drivers/media/video/v4l2-dev.c      Tue Dec 23 11:35:17 2008 +0100
@@ -30,6 +30,7 @@
 #include <asm/system.h>
 
 #include <media/v4l2-common.h>
+#include <media/v4l2-device.h>
 #include "compat.h"
 
 #define VIDEO_NUM_DEVICES      256
@@ -445,6 +446,8 @@ int video_register_device_index(struct v
 
        vdev->vfl_type = type;
        vdev->cdev = NULL;
+       if (vdev->v4l2_dev)
+               vdev->parent = vdev->v4l2_dev->dev;
 
        /* Part 2: find a free minor, kernel number and device index. */
 #ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES
diff -r 00b5856d3ee5 -r ceda70954ad6 linux/include/media/v4l2-dev.h
--- a/linux/include/media/v4l2-dev.h    Sat Dec 20 01:28:27 2008 +0100
+++ b/linux/include/media/v4l2-dev.h    Tue Dec 23 11:35:17 2008 +0100
@@ -25,6 +25,7 @@
 #define VFL_TYPE_MAX           4
 
 struct v4l2_ioctl_callbacks;
+struct v4l2_device;
 
 /* Flag to mark the video_device struct as unregistered.
    Drivers can set this flag if they want to block all future
@@ -49,7 +50,10 @@ struct video_device
        struct class_device dev;
 #endif
        struct cdev *cdev;              /* character device */
+
+       /* Set either parent or v4l2_dev if your driver uses v4l2_device */
        struct device *parent;          /* device parent */
+       struct v4l2_device *v4l2_dev;   /* v4l2_device parent */
 
        /* device info */
        char name[32];


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/ceda70954ad66ba92a2a003a1c711525f06c148c

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to