v4l2_ctrl_ha...r_init_class(9)
π v4l2_ctrl_handler_init_class β the Kernel API Manual, bestie edition β¨
okay so picture this: you're deep in the kernel source, you open ./include/media/v4l2-ctrls.h, and you meet the function that starts the whole control-handler journey. that's v4l2_ctrl_handler_init_class(9). she's giving backstage-pass energy: technically she's the one doing the work, but she does NOT want you talking to her directly. more on that in a sec π
β¨ NAME β¨
v4l2_ctrl_handler_init_class β literally just: initialize the control handler. that's it, that's the vibe π
πΈ SYNOPSIS πΈ
int v4l2_ctrl_handler_init_class (struct v4l2_ctrl_handler *hdl ,
unsigned int nr_of_controls_hint , struct lock_class_key *key , const
char *name );
yes bestie, four arguments, all of them matter, no we are not skipping any π
π¦ ARGUMENTS π¦
hdlβ the control handler herself. the main character. the one getting initialized πnr_of_controls_hintβ a lil heads-up about how many controls this handler is expected to refer to. and listen, it's the total number, so it includes any inherited controls. it doesn't have to be precise-precise, but if it's way off you get one of two β¨consequencesβ¨: either you waste memory (too many buckets get allocated ποΈ) or the control lookup gets slower (not enough buckets, so there are more slow list lookups π). either way it will always work, though. no cap. π₯keyβ used by the lock validator ifCONFIG_LOCKDEPis set πnameβ also used by the lock validator ifCONFIG_LOCKDEPis set π·οΈ
π DESCRIPTION π
ATTENTION: β οΈ
never β and I mean never β use this call directly. always use the v4l2_ctrl_handler_init macro, which hides the key and name arguments for you. she's the friendly publicist; this function is the elusive celeb behind the curtain π§
π RETURN π
returns an error if the buckets could not be allocated π and that error will also be stored in hdl->error. yes, it double-dips. she's thorough. periodt. π
π SEE ALSO π
okay this list is long and every single one of these deserves her moment, so buckle up buttercup π«Ά β all from the kernel file ./include/media/v4l2-ctrls.h:
union v4l2_ctrl_ptr(9)v4l2_ctrl_ptr_create(9)struct v4l2_ctrl_ops(9)struct v4l2_ctrl_type_ops(9)v4l2_ctrl_notify_fnc(9)struct v4l2_ctrl(9)struct v4l2_ctrl_ref(9)struct v4l2_ctrl_handler(9)struct v4l2_ctrl_config(9)v4l2_ctrl_fill(9)v4l2_ctrl_handler_init(9)v4l2_ctrl_handler_free(9)v4l2_ctrl_lock(9)v4l2_ctrl_unlock(9)__v4l2_ctrl_handler_setup(9)v4l2_ctrl_handler_setup(9)v4l2_ctrl_handler_log_status(9)v4l2_ctrl_new_custom(9)v4l2_ctrl_new_std(9)v4l2_ctrl_new_std_menu(9)v4l2_ctrl_new_std_menu_items(9)v4l2_ctrl_new_std_compound(9)v4l2_ctrl_new_int_menu(9)v4l2_ctrl_filter(9)v4l2_ctrl_add_handler(9)v4l2_ctrl_radio_filter(9)v4l2_ctrl_cluster(9)v4l2_ctrl_auto_cluster(9)v4l2_ctrl_find(9)v4l2_ctrl_activate(9)__v4l2_ctrl_grab(9)v4l2_ctrl_grab(9)__v4l2_ctrl_modify_range(9)v4l2_ctrl_modify_range(9)__v4l2_ctrl_modify_dimensions(9)v4l2_ctrl_modify_dimensions(9)v4l2_ctrl_notify(9)v4l2_ctrl_get_name(9)v4l2_ctrl_get_menu(9)v4l2_ctrl_get_int_menu(9)v4l2_ctrl_g_ctrl(9)__v4l2_ctrl_s_ctrl(9)v4l2_ctrl_s_ctrl(9)v4l2_ctrl_g_ctrl_int64(9)__v4l2_ctrl_s_ctrl_int64(9)v4l2_ctrl_s_ctrl_int64(9)__v4l2_ctrl_s_ctrl_string(9)v4l2_ctrl_s_ctrl_string(9)__v4l2_ctrl_s_ctrl_compound(9)v4l2_ctrl_s_ctrl_compound(9)v4l2_ctrl_replace(9)v4l2_ctrl_merge(9)v4l2_ctrl_log_status(9)v4l2_ctrl_subscribe_event(9)v4l2_ctrl_poll(9)v4l2_ctrl_request_setup(9)v4l2_ctrl_request_complete(9)v4l2_ctrl_request_hdl_find(9)v4l2_ctrl_request_hdl_put(9)v4l2_ctrl_request_hdl_ctrl_find(9)v4l2_queryctrl(9)v4l2_query_ext_ctrl_to_v4l2_queryctrl(9)v4l2_query_ext_ctrl(9)v4l2_querymenu(9)v4l2_g_ctrl(9)v4l2_s_ctrl(9)v4l2_g_ext_ctrls(9)v4l2_try_ext_ctrls(9)v4l2_s_ext_ctrls(9)v4l2_ctrl_subdev_subscribe_event(9)v4l2_ctrl_subdev_log_status(9)v4l2_ctrl_new_fwnode_properties(9)v4l2_ctrl_type_op_equal(9)v4l2_ctrl_type_op_init(9)v4l2_ctrl_type_op_log(9)v4l2_ctrl_type_op_validate(9)
like I said. a whole friend group ππ
and that's the whole page, bestie! this one lives in ./include/media and it's dated October 2026 β so yeah, she's from the future, she's iconic, she's booked and busy. now go use the macro like I told you π€π«Ά β¨
π¦ 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