summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/video/v4l2-dev.c3
-rw-r--r--linux/include/media/v4l2-dev.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/linux/drivers/media/video/v4l2-dev.c b/linux/drivers/media/video/v4l2-dev.c
index f877d3f86..0b832f210 100644
--- a/linux/drivers/media/video/v4l2-dev.c
+++ b/linux/drivers/media/video/v4l2-dev.c
@@ -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 video_device *vdev, int type, int nr,
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 --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h
index 6d76f0bce..c6cf5b1b2 100644
--- a/linux/include/media/v4l2-dev.h
+++ b/linux/include/media/v4l2-dev.h
@@ -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];