i2c_get_dma_safe_msg_buf(9)
π¦ i2c_get_dma_safe_msg_buf(9) π¦
okay bestie, welcome to the Kernel API Manual β¨ this one's a lil function with a big job: i2c_get_dma_safe_msg_buf β the way it just gets you a DMA safe buffer for the given i2c_msg. iconic behavior honestly π
πΈ NAME πΈ
i2c_get_dma_safe_msg_buf β grab a DMA safe buffer for the i2c_msg you handed it, no cap π«Ά
β¨ SYNOPSIS β¨
u8 * i2c_get_dma_safe_msg_buf (struct i2c_msg *msg , unsigned int
threshold );
that's the whole vibe, she takes two things and gives you back a u8 * π
π ARGUMENTS π
msgβ the message that's getting checked, like the main character of this whole operation πthresholdβ the minimum number of bytes for which using DMA actually makes sense. and listen, it should at least be1β don't be out here passing0, that's not the move π
β RETURN β
so here's the tea, there's two possible endings:
NULLβ meaning no DMA safe buffer was obtained π in that case you just usemsg->bufwith PIO, easy.- a valid pointer β this one's for using with DMA β¨ literally what you wanted.
π¨ and when you're done with that pointer? you release it by calling i2c_put_dma_safe_msg_buf. don't just leave it sitting there, that's not cute, that's a leak.
π¦ DESCRIPTION π¦
okay this is the important part, pay attention bestie π
This function must only be called from process context!
like, that's it, that's the whole rule. not interrupt context, not whatever wild place you were thinking of. process context only, periodt π
π SEE ALSO π
the whole friend group, fr fr β kernel file ./drivers/i2c/i2c-core-base.c plus:
i2c_verify_client(9), i2c_adapter_lock_bus(9), i2c_adapter_trylock_bus(9), i2c_adapter_unlock_bus(9), i2c_new_client_device(9), i2c_unregister_device(9), i2c_find_device_by_fwnode(9), i2c_new_dummy_device(9), devm_i2c_new_dummy_device(9), i2c_new_ancillary_device(9), i2c_verify_adapter(9), i2c_handle_smbus_host_notify(9), i2c_add_adapter(9), i2c_add_numbered_adapter(9), i2c_del_adapter(9), devm_i2c_add_adapter(9), i2c_find_adapter_by_fwnode(9), i2c_get_adapter_by_fwnode(9), i2c_parse_fw_timings(9), i2c_del_driver(9), __i2c_transfer(9), i2c_transfer(9), i2c_transfer_buffer_flags(9), i2c_get_device_id(9), i2c_client_get_device_id(9), i2c_put_dma_safe_msg_buf(9)
and that's the page babes π this lil masterpiece lives over in ./drivers/i2c, stamped October 2026 β go forth and DMA responsibly ππ§ββοΈ
π¦ 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