STRUCT V4L2_SUBDEV_INTERNAL_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct v4l2_subdev_internal_ops(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’… this page is all about struct v4l2_subdev_internal_ops β€” the V4L2 subdev internal ops, and yes the ops are internal, meaning they're the framework's little secret, not yours πŸ™ˆ


πŸŽ€ NAME πŸŽ€

struct v4l2_subdev_internal_ops β€” V4L2 subdev internal ops, literally the internal callback table for a V4L2 subdev πŸ’–


🌸 SYNOPSIS 🌸

struct v4l2_subdev_internal_ops {
    int (*init_state)(struct v4l2_subdev *sd, struct v4l2_subdev_state *state);
    int (*registered)(struct v4l2_subdev *sd);
    void (*unregistered)(struct v4l2_subdev *sd);
    int (*open)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
    int (*close)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
    void (*release)(struct v4l2_subdev *sd);
 };

look at that struct, it's giving "six little function pointers and a dream" πŸ¦‹


πŸ‘‘ Members πŸ‘‘

okay so here's the whole cast, no skips, no cap:

  • init_state β€” initializes the subdev state to the default values ✨
  • registered β€” gets called when this subdev is registered. when it's called, the v4l2_dev field is already set to the correct v4l2_device πŸ’–
  • unregistered β€” gets called when this subdev is unregistered. when this one runs, the v4l2_dev field is still set to the correct v4l2_device 🫢
  • open β€” called when the subdev device node gets opened by an application 🌸
  • close β€” called when the subdev device node gets closed. and bestie, heads up: it is possible for close to be called after unregistered! 😭 iykyk
  • release β€” called when the last user of the subdev device is gone. this happens after the unregistered callback, and when the last open filehandle to the v4l-subdevX device node was closed. if no device node was created for this sub-device, then the release callback is called right after the unregistered callback 🧚 the release callback is typically used to free the memory containing the v4l2_subdev structure, and it is almost certainly required for any sub-device that sets the V4L2_SUBDEV_FL_HAS_DEVNODE flag πŸ‘‘

πŸ’œ Description πŸ’œ

🚨 NOTE: Never call this from drivers, only the v4l2 framework can call these ops. like, literally, hands off 😀 this is framework-only territory, no touching from driver-land πŸ’€

🌈 SEE ALSO 🌈

the whole extended friend group, in order, no one left out 🫢 starting with the kernel file itself:

  • Kernel file ./include/media/v4l2-subdev.h

and the structs, enums and friends:


and that's the page!! πŸŽ€ this lil doc came from ./include/media, dated October 2026, and it's part of the Kernel API Manual β€” mwah, go read the source bestie, ilysm πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from