spi_mem_dirmap_write(9)
π spi_mem_dirmap_write β the "Kernel API Manual" page, bestie edition π
okay so you found yourself staring at spi_mem_dirmap_write(9) and you're like "what does this even do" β don't worry, I got you. This is the <cyan>Kernel API Manual</cyan> entry, and it's genuinely not that deep. It's giving write data through a direct mapping. Slay. β¨
π NAME π
spi_mem_dirmap_write β write data through a direct mapping, no cap π«
πΈ SYNOPSIS πΈ
ssize_t spi_mem_dirmap_write (struct spi_mem_dirmap_desc *desc , u64
offs , size_t len , const void *buf );
literally that's the whole signature, copy it exactly, don't @ me π«Ά
β¨ ARGUMENTS β¨
descβ the direct mapping descriptor. your little ticket to the mapping, bestie ποΈoffsβ offset to start writing from. and listen, 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 in your head, it's already accounted for πlenβ length in bytes. yes, bytes. the normal unit. πbufβ the source buffer. this buffer must be DMA-able β like, non-negotiable, fr fr. if it's not DMA-able that's a you problem π
π DESCRIPTION π
so basically this function writes data to a memory device π using a direct mapping that you already instantiated earlier with spi_mem_dirmap_create. that's it. that's the vibe. it's the write sibling of the read one and it's honestly so iconic for it π
lowkey important: the mapping has to exist first. this function doesn't create anything, it just uses what you set up. main character energy but make it a helper function π§
β RETURN β
it returns the amount of data written to the memory device, or a negative error code π
and here's the part people always miss β the returned size might be smaller than len. not a bug, just how it is. so if that happens, you (yes, you, the caller) are responsible for calling spi_mem_dirmap_write again. keep going until it's all written. it's giving "loop it yourself, bestie" π₯
π¦ SEE ALSO π¦
the kernel file lives at ./drivers/spi/spi-mem.c if you wanna go read the source like the icon you are π
and here's the whole friend group, all present and accounted for:
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_read(9)spi_mem_poll_status(9)spi_mem_driver_register_with_owner(9)spi_mem_driver_unregister(9)
go read spi_mem_dirmap_read(9) next, it's the twin, they're adorable together π«Ά
okay that's the page!! this was brought to you by the <mint>./drivers/spigirlies, datedOctober 2026` β same energy, same page, see you in the next manpage bestie ππβ¨
π¦ 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