media_entity_setup_link(9)
β¨ media_entity_setup_link β¨
okay so bestie, we're looking at the Kernel API Manual for media_entity_setup_link, and honestly? it's giving "small but mighty" energy. this function is literally the one that changes a media link's flags while everything's running. no cap. π
πΈ SYNOPSIS πΈ
int media_entity_setup_link(struct media_link *link, u32 flags);
π ARGUMENTS π
linkβ a pointer tomedia_link. this is the link we're about to mess with. periodt.flagsβ the requested new link flags. this is the wishlist of what you want the link to become. β¨
π DESCRIPTION π
okay so here's the tea: the only configurable property here is the MEDIA_LNK_FL_ENABLED link flag, which enables or disables a link. that's literally it. the whole menu. π
if a link is marked with MEDIA_LNK_FL_IMMUTABLE, it's untouchable. can't enable it, can't disable it. it's immutable for a reason, bestie. don't even try it. π
when a link gets enabled or disabled, the media framework calls the link_setup operation for the two entities at the source and sink of the link β in that exact order, no skipping. and if the second link_setup call fails? π the framework makes another link_setup call on the first entity to restore the original link flags. it's giving "undo button" energy and we love that for us.
media device drivers can get notified about link setup operations by setting the media_device.link_notify pointer to a callback function. if that's provided, the notification callback gets called before enabling and after disabling links. the timing? immaculate. β
entity drivers must implement the link_setup operation if any of their links is non-immutable. this is not optional, bestie. the operation has to either configure the hardware or store the configuration info to be applied later. no shortcuts, no vibes-only implementations. π
link configuration must not have any side effects on other links. literally none. if an enabled link at a sink pad prevents another link at the same pad from being enabled, the link_setup operation must return -EBUSY β and it can't just implicitly disable the first enabled link. that would be chaotic and we don't do that here. π
π¦ NOTE π¦
the valid values of the flags for the link are the same as described on media_create_pad_link, for pad to pad links β or the same as described on media_create_intf_link, for interface to entity links. iykyk. π«Ά
π SEE ALSO π
okay the cross-reference section is getting its own β¨ moment because there are so many of these and they all deserve their spotlight:
Kernel file ./include/media/media-entity.h enum media_gobj_type(9), struct media_gobj(9), struct media_entity_enum(9), struct media_graph(9), struct media_pipeline(9), struct media_pipeline_pad(9), struct media_pipeline_pad_iter(9), struct media_pipeline_entity_iter(9), struct media_link(9), enum media_pad_signal_type(9), struct media_pad(9), struct media_entity_operations(9), enum media_entity_type(9), struct media_entity(9), media_entity_for_each_pad(9), struct media_interface(9), struct media_intf_devnode(9), media_entity_id(9), media_type(9), media_id(9), media_gobj_gen_id(9), is_media_entity_v4l2_video_device(9), is_media_entity_v4l2_subdev(9), media_entity_enum_init(9), media_entity_enum_cleanup(9), media_entity_enum_zero(9), media_entity_enum_set(9), media_entity_enum_clear(9), media_entity_enum_test(9), media_entity_enum_test_and_set(9), media_entity_enum_empty(9), media_entity_enum_intersects(9), gobj_to_entity(9), gobj_to_pad(9), gobj_to_link(9), gobj_to_intf(9), intf_to_devnode(9), media_gobj_create(9), media_gobj_destroy(9), media_entity_pads_init(9), media_entity_cleanup(9), media_get_pad_index(9), media_create_pad_link(9), media_create_pad_links(9), media_entity_remove_links(9), __media_entity_setup_link(9), media_entity_find_link(9), media_pad_remote_pad_first(9), media_pad_remote_pad_unique(9), media_entity_remote_pad_unique(9), media_entity_remote_source_pad_unique(9), media_pad_is_streaming(9), media_entity_is_streaming(9), media_entity_pipeline(9), media_pad_pipeline(9), media_entity_get_fwnode_pad(9), media_graph_walk_init(9), media_graph_walk_cleanup(9), media_graph_walk_start(9), media_graph_walk_next(9), media_pipeline_start(9), __media_pipeline_start(9), media_pipeline_stop(9), __media_pipeline_stop(9), media_pipeline_for_each_pad(9), media_pipeline_entity_iter_init(9), media_pipeline_entity_iter_cleanup(9), media_pipeline_for_each_entity(9), media_pipeline_alloc_start(9), media_devnode_create(9), media_devnode_remove(9), media_create_intf_link(9), __media_remove_intf_link(9), media_remove_intf_link(9), __media_remove_intf_links(9), media_remove_intf_links(9), media_entity_call(9), media_create_ancillary_link(9), __media_entity_next_link(9), for_each_media_entity_data_link(9)
like, that's a whole friend group right there. ππ₯
and that's the whole page, bestie! this gem lives in the kernel file ./include/media, dated October 2026, and it's part of the Kernel API Manual β bringing main character energy to media links since forever. ππ go forth and configure those links responsibly. β¨πΈ
π¦ 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