drm_dp_mst_t...try_get_mstb(9)
π drm_dp_mst_topology_try_get_mstb
okay so picture this: you're out here in the kernel, you've got a struct drm_dp_mst_branch * and you're like "hiii can I have a topology ref on this please?" β and this function is the one that says "sure bestie, if you got here in time." It bumps the topology refcount of a branch device, but only if that refcount isn't already zero. No cap, that's the whole vibe. πΈ
This page lives in the Kernel API Manual and honestly it's giving very much "small function, big consequences." Let's get into it. β¨
π SYNOPSIS
int drm_dp_mst_topology_try_get_mstb (struct drm_dp_mst_branch *mstb );
π ARGUMENTS
mstbβ thestruct drm_dp_mst_branchwhose topology refcount you're trying to increment. that's the target, that's the main character π
π¦ DESCRIPTION
So what actually happens? It attempts to grab a topology reference to mstb, but only if mstb hasn't been removed from the topology yet β like, if drm_dp_mst_branch.topology_kref has reached 0, the door's closed and you're not getting in, sorry not sorry. πͺπ
Here's the important bit though (and it's lowkey iconic): holding a topology reference implies that a malloc reference will be held to mstb for as long as the user holds that topology reference. so like, one buy-one-get-one deal, except it's refcounting and if you fumble it the kernel gets sad. π«Ά
Care should be taken to ensure that the user has at least one malloc reference to mstb β do not skip this, it's the whole assignment, it's due at midnight. π
And hey, if you already have a topology reference to mstb? Then this isn't the function for you, bestie β you should be using drm_dp_mst_topology_get_mstb instead. Different tool, different job. β
See also: drm_dp_mst_topology_get_mstb drm_dp_mst_topology_put_mstb
π RETURN
1β slay, it worked, a topology reference was grabbed successfully β¨π0β nope: port is no longer in the topology, no reference was grabbed. the vibes were off, the door was locked, you get nothing π₯²
π SEE ALSO
First up, the source file where all this magic lives:
Kernel file ./drivers/gpu/drm/display/drm_dp_mst_topology.c
Plus these two reads, which are absolutely required reading, iykyk:
dp mst helper(9)Branch device and port refcounting(9)
and then, in no particular order, the entire extended friend group π π₯:
drm_dp_mst_get_mstb_malloc(9)drm_dp_mst_put_mstb_malloc(9)drm_dp_mst_get_port_malloc(9)drm_dp_mst_put_port_malloc(9)drm_dp_mst_topology_get_mstb(9)drm_dp_mst_topology_put_mstb(9)drm_dp_mst_topology_try_get_port(9)drm_dp_mst_topology_get_port(9)drm_dp_mst_topology_put_port(9)drm_dp_mst_dpcd_read(9)drm_dp_mst_dpcd_write(9)drm_dp_mst_connector_late_register(9)drm_dp_mst_connector_early_unregister(9)drm_dp_add_payload_part1(9)drm_dp_remove_payload_part1(9)drm_dp_remove_payload_part2(9)drm_dp_add_payload_part2(9)drm_dp_get_vc_payload_bw(9)drm_dp_read_mst_cap(9)drm_dp_mst_topology_mgr_set_mst(9)drm_dp_mst_topology_queue_probe(9)drm_dp_mst_topology_mgr_suspend(9)drm_dp_mst_topology_mgr_resume(9)drm_dp_mst_hpd_irq_handle_event(9)drm_dp_mst_hpd_irq_send_new_request(9)drm_dp_mst_detect_port(9)drm_dp_mst_edid_read(9)drm_dp_mst_get_edid(9)drm_dp_atomic_find_time_slots(9)drm_dp_atomic_release_time_slots(9)drm_dp_mst_atomic_setup_commit(9)drm_dp_mst_atomic_wait_for_dependencies(9)drm_dp_mst_root_conn_atomic_check(9)drm_dp_mst_update_slots(9)drm_dp_check_act_status(9)drm_dp_calc_pbn_mode(9)drm_dp_mst_dump_topology(9)drm_dp_mst_port_downstream_of_parent(9)drm_dp_mst_add_affected_dsc_crtcs(9)drm_dp_mst_atomic_enable_dsc(9)drm_dp_mst_atomic_check_mgr(9)drm_dp_mst_atomic_check(9)drm_atomic_get_mst_topology_state(9)drm_atomic_get_old_mst_topology_state(9)drm_atomic_get_new_mst_topology_state(9)drm_dp_mst_topology_mgr_init(9)drm_dp_mst_topology_mgr_destroy(9)drm_dp_mst_register_i2c_bus(9)drm_dp_mst_unregister_i2c_bus(9)drm_dp_mst_is_virtual_dpcd(9)drm_dp_mst_aux_for_parent(9)drm_dp_mst_dsc_aux_for_port(9)
like I said. entire friend group. go say hi to all of them. π§π
mwah, that's the page! brought to you straight outta ./drivers/gpu/drm/display, dated October 2026 β go grab that topology reference (if it's not zero) and stay iconic ππ
π¦ 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