spi_mem_dirmap_read(9)
π 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 thanlen, and if that happens the caller is responsible for callingspi_mem_dirmap_readagain. 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 πΈ
spi_controller_dma_map_mem_op_data(9)spi_controller_dma_unmap_mem_op_data(9)spi_mem_supports_op(9)spi_mem_exec_op(9)spi_mem_get_name(9)spi_mem_set_dqs(9)spi_mem_has_dqs(9)spi_mem_adjust_op_size(9)spi_mem_adjust_op_freq(9)spi_mem_calc_op_duration(9)spi_mem_dirmap_create(9)spi_mem_dirmap_destroy(9)devm_spi_mem_dirmap_create(9)devm_spi_mem_dirmap_destroy(9)spi_mem_dirmap_write(9)spi_mem_poll_status(9)spi_mem_driver_register_with_owner(9)spi_mem_driver_unregister(9)
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
- 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