SSAM_DEFINE...REQUEST_MD_R(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… SSAM_DEFINE_SYNC_REQUEST_MD_R β€” a.k.a. the "make me a multi-device SAM request function that gives stuff back" macro πŸ’…

okay so bestie, welcome to section 9 of the Kernel API Manual β€” yes this is kernel-internals territory, but honestly? you're gonna slay. this page is literally about a macro that writes a whole function for you, no cap. 🫢


✨ SYNOPSIS ✨

SSAM_DEFINE_SYNC_REQUEST_MD_R (name , rtype , spec... );

like, that's it. that's the whole call. iconic. πŸŽ€


🌸 ARGUMENTS 🌸

  • name β€” what you're naming the generated function. your baby, your choice of name. πŸ’–
  • rtype β€” the type of the request's return value. so like, what flavour of data comes back out. πŸ“
  • spec β€” the specification (struct ssam_request_spec_md) that defines the request. this is the blueprint, the whole vibe check of what the request actually is. ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: this macro defines a function that executes the synchronous SAM request specified by spec. the request takes no argument but it does have a return value of type rtype. πŸŽ€

the device-specifying parameters? not hard-coded, bestie β€” nope. they have to be handed to the function when you call it. so the generated function is out here taking care of everything: setting up the request and response structs, buffer allocation, and the execution of the request itself β€” and it returns once the request has been fully completed. the way that it just handles all of that for you? obsessed. 😭πŸ”₯

also important: the required transport buffer gets allocated on the stack. 🫢

the generated function is defined exactly like this:

static int name(struct ssam_controller *ctrl, u8 tid, u8 iid, rtype *ret)

and it returns the status of the request, which is zero on success and negative on failure. πŸ’€

breaking down the params, because iykyk:

  • the ctrl parameter is the controller via which the request is sent 🌈
  • tid is the target ID for the request 🎯
  • iid is the instance ID πŸ”–
  • the request's return value gets written to the memory pointed to by the ret parameter πŸ’Ύ
ngl, if you want the full behaviour of the generated function, go read ssam_request_do_sync_onstack β€” that's the real one to stan for details. πŸ‘‘

πŸ‘‘ SEE ALSO πŸ‘‘

like, that's a whole friend group right there. go say hi. πŸŒΈπŸ’œ


and that's the page, babe ✨ coming at you straight from the Kernel API Manual, section 9, sourced from ./include/linux/surface_aggreg... and dated October 2026 β€” periodt. πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from