v4l2_device_for_each_subdev(9)
π v4l2_device_for_each_subdev(9) β from the Kernel API Manual, bestie
okay so picture this: it's a macro, it's in the kernel, and it's about to loop over every single sub-device like it's scrolling your fyp. Let's get into it π«Ά
β¨ NAME β¨
v4l2_device_for_each_subdev β a helper macro that iterates over all sub-devices of a given &v4l2_device. literally that's its whole job and it ate π
πΈ SYNOPSIS πΈ
v4l2_device_for_each_subdev (sd , v4l2_dev );
π ARGUMENTS π
sdβ a pointer that the macro fills in with allstruct v4l2_subdevpointers; it's used as the iterator by the loop. so yeah,sdis the main character here πv4l2_devβ thestruct v4l2_devicethat owns the sub-devices you're iterating over. it's giving parent energy.
π¦ DESCRIPTION π¦
This macro iterates over every sub-device owned by the v4l2_dev device. It acts as a for loop iterator, and it executes the next statement with the sd variable pointing to each sub-device in turn β one at a time, no skipping, no cap β¨
like, the way that it just hands you each sub-device and lets you do your thing? obsessed.
π SEE ALSO π
Kernel file ./include/media/v4l2-device.h β and the whole friend group:
struct v4l2_device(9)v4l2_device_get(9)v4l2_device_put(9)v4l2_device_register(9)v4l2_device_set_name(9)v4l2_device_disconnect(9)v4l2_device_unregister(9)v4l2_device_register_subdev(9)v4l2_device_unregister_subdev(9)__v4l2_device_register_subdev_nodes(9)v4l2_device_register_subdev_nodes(9)v4l2_device_register_ro_subdev_nodes(9)v4l2_subdev_notify(9)v4l2_device_supports_requests(9)__v4l2_device_call_subdevs_p(9)__v4l2_device_call_subdevs(9)__v4l2_device_call_subdevs_until_err_p(9)__v4l2_device_call_subdevs_until_err(9)v4l2_device_call_all(9)v4l2_device_call_until_err(9)v4l2_device_mask_call_all(9)v4l2_device_mask_call_until_err(9)v4l2_device_has_op(9)v4l2_device_mask_has_op(9)
ngl, that's a long SEE ALSO. but like, slay for them, they're all iconic π
okay that's the whole page, mwah π this one lives in ./include/media, dated October 2026, and the version is literally just v4l2_device_for_each_subdev(9) again because kernel manpages love a self-reference π byeee, go loop over some sub-devices bestie π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms