Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] v4l2-framework: replace g_chip_ident by g_std in the examples

The framework documentation used the g_chip_ident op as an example. This
op has been removed, so replace its use in the examples by the g_std op.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
2249aa5c abbec2d4

+12 -14
+6 -7
Documentation/video4linux/v4l2-framework.txt
··· 246 246 It looks like this: 247 247 248 248 struct v4l2_subdev_core_ops { 249 - int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 250 249 int (*log_status)(struct v4l2_subdev *sd); 251 250 int (*init)(struct v4l2_subdev *sd, u32 val); 252 251 ... ··· 345 346 346 347 You can call an ops function either directly: 347 348 348 - err = sd->ops->core->g_chip_ident(sd, &chip); 349 + err = sd->ops->core->g_std(sd, &norm); 349 350 350 351 but it is better and easier to use this macro: 351 352 352 - err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); 353 + err = v4l2_subdev_call(sd, core, g_std, &norm); 353 354 354 355 The macro will to the right NULL pointer checks and returns -ENODEV if subdev 355 - is NULL, -ENOIOCTLCMD if either subdev->core or subdev->core->g_chip_ident is 356 - NULL, or the actual result of the subdev->ops->core->g_chip_ident ops. 356 + is NULL, -ENOIOCTLCMD if either subdev->core or subdev->core->g_std is 357 + NULL, or the actual result of the subdev->ops->core->g_std ops. 357 358 358 359 It is also possible to call all or a subset of the sub-devices: 359 360 360 - v4l2_device_call_all(v4l2_dev, 0, core, g_chip_ident, &chip); 361 + v4l2_device_call_all(v4l2_dev, 0, core, g_std, &norm); 361 362 362 363 Any subdev that does not support this ops is skipped and error results are 363 364 ignored. If you want to check for errors use this: 364 365 365 - err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_chip_ident, &chip); 366 + err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_std, &norm); 366 367 367 368 Any error except -ENOIOCTLCMD will exit the loop with that error. If no 368 369 errors (except -ENOIOCTLCMD) occurred, then 0 is returned.
+6 -7
Documentation/zh_CN/video4linux/v4l2-framework.txt
··· 247 247 这些结构体定义如下: 248 248 249 249 struct v4l2_subdev_core_ops { 250 - int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 251 250 int (*log_status)(struct v4l2_subdev *sd); 252 251 int (*init)(struct v4l2_subdev *sd, u32 val); 253 252 ... ··· 336 337 337 338 注册之设备后,可通过以下方式直接调用其操作函数: 338 339 339 - err = sd->ops->core->g_chip_ident(sd, &chip); 340 + err = sd->ops->core->g_std(sd, &norm); 340 341 341 342 但使用如下宏会比较容易且合适: 342 343 343 - err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); 344 + err = v4l2_subdev_call(sd, core, g_std, &norm); 344 345 345 346 这个宏将会做 NULL 指针检查,如果 subdev 为 NULL,则返回-ENODEV;如果 346 - subdev->core 或 subdev->core->g_chip_ident 为 NULL,则返回 -ENOIOCTLCMD; 347 - 否则将返回 subdev->ops->core->g_chip_ident ops 调用的实际结果。 347 + subdev->core 或 subdev->core->g_std 为 NULL,则返回 -ENOIOCTLCMD; 348 + 否则将返回 subdev->ops->core->g_std ops 调用的实际结果。 348 349 349 350 有时也可能同时调用所有或一系列子设备的某个操作函数: 350 351 351 - v4l2_device_call_all(v4l2_dev, 0, core, g_chip_ident, &chip); 352 + v4l2_device_call_all(v4l2_dev, 0, core, g_std, &norm); 352 353 353 354 任何不支持此操作的子设备都会被跳过,并忽略错误返回值。但如果你需要 354 355 检查出错码,则可使用如下函数: 355 356 356 - err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_chip_ident, &chip); 357 + err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_std, &norm); 357 358 358 359 除 -ENOIOCTLCMD 外的任何错误都会跳出循环并返回错误值。如果(除 -ENOIOCTLCMD 359 360 外)没有错误发生,则返回 0。