diff options
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 |