diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2009-12-09 06:40:05 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 03:53:18 -0400 |
commit | 95db3a60e0652a52df145aacade1a88c5acef659 (patch) | |
tree | 7b8a14a964684ecd49667125e5429360e41c11d5 /Documentation | |
parent | e02188c90f6ef61f0844c42508fe603c5d4fa42b (diff) |
[media] v4l: Add a media_device pointer to the v4l2_device structure
The pointer will later be used to register/unregister media entities
when registering/unregistering a v4l2_subdev or a video_device.
With the introduction of media devices, device drivers need to store a
pointer to a driver-specific structure in the device's drvdata.
v4l2_device can't claim ownership of the drvdata anymore.
To maintain compatibility with drivers that rely on v4l2_device storing
a pointer to itself in the device's drvdata, v4l2_device_register() will
keep doing so if the drvdata is NULL.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/video4linux/v4l2-framework.txt | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index eb8479565dc4..7de55cfae04e 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt | |||
@@ -83,11 +83,17 @@ You must register the device instance: | |||
83 | 83 | ||
84 | v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); | 84 | v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); |
85 | 85 | ||
86 | Registration will initialize the v4l2_device struct and link dev->driver_data | 86 | Registration will initialize the v4l2_device struct. If the dev->driver_data |
87 | to v4l2_dev. If v4l2_dev->name is empty then it will be set to a value derived | 87 | field is NULL, it will be linked to v4l2_dev. Drivers that use the media |
88 | from dev (driver name followed by the bus_id, to be precise). If you set it | 88 | device framework in addition to the V4L2 framework need to set |
89 | up before calling v4l2_device_register then it will be untouched. If dev is | 89 | dev->driver_data manually to point to the driver-specific device structure |
90 | NULL, then you *must* setup v4l2_dev->name before calling v4l2_device_register. | 90 | that embed the struct v4l2_device instance. This is achieved by a |
91 | dev_set_drvdata() call before registering the V4L2 device instance. | ||
92 | |||
93 | If v4l2_dev->name is empty then it will be set to a value derived from dev | ||
94 | (driver name followed by the bus_id, to be precise). If you set it up before | ||
95 | calling v4l2_device_register then it will be untouched. If dev is NULL, then | ||
96 | you *must* setup v4l2_dev->name before calling v4l2_device_register. | ||
91 | 97 | ||
92 | You can use v4l2_device_set_name() to set the name based on a driver name and | 98 | You can use v4l2_device_set_name() to set the name based on a driver name and |
93 | a driver-global atomic_t instance. This will generate names like ivtv0, ivtv1, | 99 | a driver-global atomic_t instance. This will generate names like ivtv0, ivtv1, |
@@ -108,6 +114,7 @@ You unregister with: | |||
108 | 114 | ||
109 | v4l2_device_unregister(struct v4l2_device *v4l2_dev); | 115 | v4l2_device_unregister(struct v4l2_device *v4l2_dev); |
110 | 116 | ||
117 | If the dev->driver_data field points to v4l2_dev, it will be reset to NULL. | ||
111 | Unregistering will also automatically unregister all subdevs from the device. | 118 | Unregistering will also automatically unregister all subdevs from the device. |
112 | 119 | ||
113 | If you have a hotpluggable device (e.g. a USB device), then when a disconnect | 120 | If you have a hotpluggable device (e.g. a USB device), then when a disconnect |