mirror of
https://github.com/torvalds/linux.git
synced 2024-09-23 00:13:17 +00:00
V4L/DVB (9974): 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. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
dc93a70cc7
commit
9bea3514dd
|
@ -30,6 +30,7 @@
|
||||||
#include <asm/system.h>
|
#include <asm/system.h>
|
||||||
|
|
||||||
#include <media/v4l2-common.h>
|
#include <media/v4l2-common.h>
|
||||||
|
#include <media/v4l2-device.h>
|
||||||
|
|
||||||
#define VIDEO_NUM_DEVICES 256
|
#define VIDEO_NUM_DEVICES 256
|
||||||
#define VIDEO_NAME "video4linux"
|
#define VIDEO_NAME "video4linux"
|
||||||
|
@ -407,6 +408,8 @@ int video_register_device_index(struct video_device *vdev, int type, int nr,
|
||||||
|
|
||||||
vdev->vfl_type = type;
|
vdev->vfl_type = type;
|
||||||
vdev->cdev = NULL;
|
vdev->cdev = NULL;
|
||||||
|
if (vdev->v4l2_dev)
|
||||||
|
vdev->parent = vdev->v4l2_dev->dev;
|
||||||
|
|
||||||
/* Part 2: find a free minor, kernel number and device index. */
|
/* Part 2: find a free minor, kernel number and device index. */
|
||||||
#ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES
|
#ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#define VFL_TYPE_MAX 4
|
#define VFL_TYPE_MAX 4
|
||||||
|
|
||||||
struct v4l2_ioctl_callbacks;
|
struct v4l2_ioctl_callbacks;
|
||||||
|
struct v4l2_device;
|
||||||
|
|
||||||
/* Flag to mark the video_device struct as unregistered.
|
/* Flag to mark the video_device struct as unregistered.
|
||||||
Drivers can set this flag if they want to block all future
|
Drivers can set this flag if they want to block all future
|
||||||
|
@ -45,7 +46,10 @@ struct video_device
|
||||||
/* sysfs */
|
/* sysfs */
|
||||||
struct device dev; /* v4l device */
|
struct device dev; /* v4l device */
|
||||||
struct cdev *cdev; /* character device */
|
struct cdev *cdev; /* character device */
|
||||||
|
|
||||||
|
/* Set either parent or v4l2_dev if your driver uses v4l2_device */
|
||||||
struct device *parent; /* device parent */
|
struct device *parent; /* device parent */
|
||||||
|
struct v4l2_device *v4l2_dev; /* v4l2_device parent */
|
||||||
|
|
||||||
/* device info */
|
/* device info */
|
||||||
char name[32];
|
char name[32];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user