spi_sync(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… spi_sync(9) β€” the manual page, bestie edition

okay so this is a Kernel API Manual page for spi_sync, and honestly? it's a whole vibe. it's the "just do it synchronously and let me nap until it's done" SPI transfer call πŸ¦‹


✨ NAME ✨

spi_sync β€” blocking/synchronous SPI data transfers 🌸

like, you hand it a message, you wait, you get your answer. no callbacks, no chaos, no "we'll get back to you." periodt.


✨ SYNOPSIS ✨

int spi_sync (struct spi_device *spi , struct spi_message *message );

✨ ARGUMENTS ✨

  • spi β€” the device you're exchanging data with 🫢 like, who are we talking to
  • message β€” describes the data transfers β€” the whole itinerary of the trip, basically

✨ CONTEXT ✨

can sleep 😴


✨ DESCRIPTION ✨

okay so the big rule: this call may only be used from a context that may sleep. and not like a cute little nap either β€” the sleep is non-interruptible, and it has no timeout. it's giving main character energy that refuses to be woken up early πŸ’€

the good news? low-overhead controller drivers may DMA directly into and out of the message buffers. highkey efficient. πŸ”₯

also note πŸ‘€ β€” the SPI device's chip select is active during the message, and then is normally disabled between messages. some drivers for frequently-used devices might wanna minimize the cost of selecting a chip by leaving it selected, anticipating that the next message goes to the same chip. (just know that may increase power usage 🌈)

and one more thing, bestie, this is important: the caller is guaranteeing that the memory associated with the message will not be freed before this call returns. no cap. if you free it early, that's on you πŸ™ˆ


✨ RETURN ✨

zero on success ✨ else a negative error code 😭


✨ SEE ALSO ✨

kernel file ./drivers/spi/spi.c and the whole friend group:


ok that's the whole page, no details skipped, i promise πŸŽ€ go forth and transfer synchronously, queen πŸ‘‘

and that's a wrap! this one came from the ./drivers/spi directory, dated October 2026 β€” mwah, tysm for reading, ily, bye πŸ’–βœ¨πŸ§š

πŸ“¦ where this page comes from