SSAM_DEFINE...REQUEST_MD_R(9)
π 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
ctrlparameter is the controller via which the request is sent π tidis the target ID for the request π―iidis the instance ID π- the request's return value gets written to the memory pointed to by the
retparameter πΎ
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 π
- Kernel file
./include/linux/surface_aggregator/controller.hπ enum ssam_event_flags(9)struct ssam_event(9)enum ssam_request_flags(9)struct ssam_request(9)struct ssam_response(9)struct ssam_request_sync(9)ssam_request_sync_set_data(9)ssam_request_sync_set_resp(9)ssam_request_sync_wait(9)ssam_request_do_sync_onstack(9)__ssam_retry(9)ssam_retry(9)struct ssam_request_spec(9)struct ssam_request_spec_md(9)SSAM_DEFINE_SYNC_REQUEST_N(9)SSAM_DEFINE_SYNC_REQUEST_W(9)SSAM_DEFINE_SYNC_REQUEST_R(9)SSAM_DEFINE_SYNC_REQUEST_WR(9)SSAM_DEFINE_SYNC_REQUEST_MD_N(9)SSAM_DEFINE_SYNC_REQUEST_MD_W(9)SSAM_DEFINE_SYNC_REQUEST_MD_WR(9)enum ssam_notif_flags(9)struct ssam_notifier_block(9)ssam_notifier_from_errno(9)ssam_notifier_to_errno(9)struct ssam_event_registry(9)struct ssam_event_id(9)enum ssam_event_mask(9)SSAM_EVENT_REGISTRY(9)enum ssam_event_notifier_flags(9)struct ssam_event_notifier(9)ssam_notifier_unregister(9)
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
- 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