aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/video4linux/v4l2-framework.txt
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-02-07 05:07:04 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:41 -0400
commit89aec3e1baaddeaa5636487f0e23f807eb758168 (patch)
treea9e7b4fb4636e059328dfd05afef111bbfe8ed5c /Documentation/video4linux/v4l2-framework.txt
parent8ac05ae3192ce8a71fc84e4a88772cce0c09173c (diff)
V4L/DVB (10489): doc: use consistent naming conventions for vdev and v4l2_dev.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation/video4linux/v4l2-framework.txt')
-rw-r--r--Documentation/video4linux/v4l2-framework.txt22
1 files changed, 11 insertions, 11 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
index cc350624237d..73f9b642392b 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -134,7 +134,7 @@ The recommended approach is as follows:
134 134
135static atomic_t drv_instance = ATOMIC_INIT(0); 135static atomic_t drv_instance = ATOMIC_INIT(0);
136 136
137static int __devinit drv_probe(struct pci_dev *dev, 137static int __devinit drv_probe(struct pci_dev *pdev,
138 const struct pci_device_id *pci_id) 138 const struct pci_device_id *pci_id)
139{ 139{
140 ... 140 ...
@@ -218,7 +218,7 @@ to add new ops and categories.
218 218
219A sub-device driver initializes the v4l2_subdev struct using: 219A sub-device driver initializes the v4l2_subdev struct using:
220 220
221 v4l2_subdev_init(subdev, &ops); 221 v4l2_subdev_init(sd, &ops);
222 222
223Afterwards you need to initialize subdev->name with a unique name and set the 223Afterwards you need to initialize subdev->name with a unique name and set the
224module owner. This is done for you if you use the i2c helper functions. 224module owner. This is done for you if you use the i2c helper functions.
@@ -226,7 +226,7 @@ module owner. This is done for you if you use the i2c helper functions.
226A device (bridge) driver needs to register the v4l2_subdev with the 226A device (bridge) driver needs to register the v4l2_subdev with the
227v4l2_device: 227v4l2_device:
228 228
229 int err = v4l2_device_register_subdev(device, subdev); 229 int err = v4l2_device_register_subdev(v4l2_dev, sd);
230 230
231This can fail if the subdev module disappeared before it could be registered. 231This can fail if the subdev module disappeared before it could be registered.
232After this function was called successfully the subdev->dev field points to 232After this function was called successfully the subdev->dev field points to
@@ -234,17 +234,17 @@ the v4l2_device.
234 234
235You can unregister a sub-device using: 235You can unregister a sub-device using:
236 236
237 v4l2_device_unregister_subdev(subdev); 237 v4l2_device_unregister_subdev(sd);
238 238
239Afterwards the subdev module can be unloaded and subdev->dev == NULL. 239Afterwards the subdev module can be unloaded and sd->dev == NULL.
240 240
241You can call an ops function either directly: 241You can call an ops function either directly:
242 242
243 err = subdev->ops->core->g_chip_ident(subdev, &chip); 243 err = sd->ops->core->g_chip_ident(sd, &chip);
244 244
245but it is better and easier to use this macro: 245but it is better and easier to use this macro:
246 246
247 err = v4l2_subdev_call(subdev, core, g_chip_ident, &chip); 247 err = v4l2_subdev_call(sd, core, g_chip_ident, &chip);
248 248
249The macro will to the right NULL pointer checks and returns -ENODEV if subdev 249The macro will to the right NULL pointer checks and returns -ENODEV if subdev
250is NULL, -ENOIOCTLCMD if either subdev->core or subdev->core->g_chip_ident is 250is NULL, -ENOIOCTLCMD if either subdev->core or subdev->core->g_chip_ident is
@@ -252,12 +252,12 @@ NULL, or the actual result of the subdev->ops->core->g_chip_ident ops.
252 252
253It is also possible to call all or a subset of the sub-devices: 253It is also possible to call all or a subset of the sub-devices:
254 254
255 v4l2_device_call_all(dev, 0, core, g_chip_ident, &chip); 255 v4l2_device_call_all(v4l2_dev, 0, core, g_chip_ident, &chip);
256 256
257Any subdev that does not support this ops is skipped and error results are 257Any subdev that does not support this ops is skipped and error results are
258ignored. If you want to check for errors use this: 258ignored. If you want to check for errors use this:
259 259
260 err = v4l2_device_call_until_err(dev, 0, core, g_chip_ident, &chip); 260 err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_chip_ident, &chip);
261 261
262Any error except -ENOIOCTLCMD will exit the loop with that error. If no 262Any error except -ENOIOCTLCMD will exit the loop with that error. If no
263errors (except -ENOIOCTLCMD) occured, then 0 is returned. 263errors (except -ENOIOCTLCMD) occured, then 0 is returned.
@@ -505,8 +505,8 @@ There are a few useful helper functions:
505 505
506You can set/get driver private data in the video_device struct using: 506You can set/get driver private data in the video_device struct using:
507 507
508void *video_get_drvdata(struct video_device *dev); 508void *video_get_drvdata(struct video_device *vdev);
509void video_set_drvdata(struct video_device *dev, void *data); 509void video_set_drvdata(struct video_device *vdev, void *data);
510 510
511Note that you can safely call video_set_drvdata() before calling 511Note that you can safely call video_set_drvdata() before calling
512video_register_device(). 512video_register_device().