spi_mem_dirmap_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… spi_mem_dirmap_read β€” read data through a direct mapping ✨

okay so bestie, welcome to the spi_mem_dirmap_read(9) page from the Kernel API Manual 🫢 this is the little function that pulls data out of a memory device through a direct mapping, and honestly? it's giving "fast lane for your bytes" 🌈


✨ NAME ✨

spi_mem_dirmap_read β€” read data through a direct mapping πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

ssize_t spi_mem_dirmap_read (struct spi_mem_dirmap_desc *desc , u64 offs
, size_t len , void *buf );

that's the whole signature, no cap. four things go in, and a ssize_t comes out πŸ‘‘


🌸 ARGUMENTS 🌸

  • desc β€” the direct mapping descriptor. this is your lil handle to the mapping, your backstage pass 🎟️
  • offs β€” offset to start reading from. ⚠️ and like, pay attention here bestie: this is not an absolute offset, it's the offset within the direct mapping β€” which already has its own offset. so don't go adding things up, iykyk πŸ™ˆ
  • len β€” length in bytes, obviously πŸ’…
  • buf β€” destination buffer. this buffer must be DMA-able, no exceptions, that's a hard requirement πŸ”₯

πŸ¦‹ DESCRIPTION πŸ¦‹

this function reads data from a memory device using a direct mapping that was previously instantiated with spi_mem_dirmap_create. so like, the mapping has to exist already β€” you can't just show up uninvited, that's not main character energy, that's just rude 😭


⭐ RETURN ⭐

it returns the amount of data read from the memory device, or a negative error code if things went sideways πŸ’€

🚨 big heads up: the returned size might be smaller than len, and if that happens the caller is responsible for calling spi_mem_dirmap_read again. so yeah, you gotta loop, bestie β€” it's not a one-and-done situation πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file ./drivers/spi/spi-mem.c plus the whole friend group 🌸


and that's the page, periodt πŸ’œ this one lives under ./drivers/spi, dated October 2026, and it's part of the Kernel API Manual β€” go read the source, it ate πŸ“βœ¨

πŸ“¦ where this page comes from