drm_dp_mst_t...try_get_mstb(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the struct drm_dp_mst_branch whose 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 πŸ’…πŸ”₯:

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