spi_sync_locked(9)
π spi_sync_locked(9) β the kernel API manual, bestie edition
okay so this is a page from the Kernel API Manual (yes, the (9) one, kernel-doc section, we're fancy here) and it's all about spi_sync_locked β the version of spi_sync that gets the SPI bus all to itself πβ¨
πΈ NAME πΈ
spi_sync_locked β literally the version of spi_sync with exclusive bus usage, no cap π
π SYNOPSIS π
int spi_sync_locked (struct spi_device *spi , struct spi_message
*message );
that's the whole signature, she's not complicated π
π¦ ARGUMENTS π¦
spiβ the device with which data will be exchanged π«Άmessageβ describes the data transfers π¨
π CONTEXT π
cannot sleep? no bestie, the opposite β can sleep π΄β¨
π₯ DESCRIPTION π₯
So here's the tea β β this call may only be used from a context that may sleep. And the sleep? It's non-interruptible, and it has no timeout. So likeβ¦ she's committed. She's not waking up early, she's not checking her phone, she's just in it until it's done π
Also, low-overhead controller drivers may DMA directly into and out of the message buffers. iconic behaviour honestly π
This call should be used by drivers that require exclusive access to the SPI bus. It has to be preceded by a spi_bus_lock call β like, you literally can't skip that step, it's giving prerequisites, it's giving prerequisites-fr-fr. And when the exclusive access is over, the SPI bus must be released by a spi_bus_unlock call. lock β do the thing β unlock. the trinity π€
lowkey a vibe check on your locking discipline: forget the unlock and everyone's stuck. just saying π
β RETURN β
zero on success π β else a negative error code π
π SEE ALSO π
okay this list is long but we do not skip, we do not summarise, we list every single one because that's the assignment π
The Kernel file is ./drivers/spi/spi.c and here's everybody:
__spi_register_driver(9)spi_alloc_device(9)spi_add_device(9)spi_new_device(9)spi_unregister_device(9)spi_register_board_info(9)spi_res_alloc(9)spi_res_free(9)spi_res_add(9)spi_res_release(9)spi_finalize_current_transfer(9)__spi_pump_messages(9)spi_pump_messages(9)spi_take_timestamp_pre(9)spi_take_timestamp_post(9)spi_set_thread_rt(9)spi_get_next_queued_message(9)spi_finalize_current_message(9)spi_queued_transfer(9)spi_flush_queue(9)of_register_spi_devices(9)spi_new_ancillary_device(9)devm_spi_new_ancillary_device(9)acpi_spi_count_resources(9)acpi_spi_device_alloc(9)spi_target_abort(9)__spi_alloc_controller(9)__devm_spi_alloc_controller(9)spi_get_gpio_descs(9)spi_register_controller(9)devm_spi_register_controller(9)spi_unregister_controller(9)spi_replace_transfers(9)spi_split_transfers_maxsize(9)spi_split_transfers_maxwords(9)spi_set_cs_timing(9)spi_setup(9)spi_optimize_message(9)spi_unoptimize_message(9)devm_spi_optimize_message(9)spi_async(9)spi_sync(9)spi_bus_lock(9)spi_bus_unlock(9)spi_write_then_read(9)
and that's the page, bestie π«Ά this one lives under ./drivers/spi, dated October 2026, and it's spi_sync_locked(9) all the way down β go lock that bus, slay responsibly, and remember to unlock πβ¨π
π¦ 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