i2c_trylock_bus(9)
π i2c_trylock_bus(9) β bestie, this is from the Kernel API Manual
Okay so picture this: you're deep in the kernel, you've got an I2C bus segment, and you want exclusive access to it β but like, only if it's free. You are not about to wait around. This is i2c_trylock_bus(9), and it's giving "try before you commit" energy. π
β¨ SYNOPSIS β¨
int i2c_trylock_bus (struct i2c_adapter *adapter , unsigned int flags );
Two things go in, one int comes out. Simple. Iconic. π¦
πΈ ARGUMENTS πΈ
adapterβ the target I2C bus segment. Like, the actual bus you're trying to claim. Point at it and go πflagsβ this is where you pick your vibe:I2C_LOCK_ROOT_ADAPTERtries to lock the root i2c adapter (yes, the whole top-level situation π)I2C_LOCK_SEGMENTtries to lock only this branch in the adapter tree πΏ β very "just this one, not the whole family" of it
β RETURN β
Returns true if the I2C bus segment is locked, false otherwise. That's it. No drama, just a yes or a no. π«Ά
Heads up bestie: the page saystrue/false, but the function signature isintβ I'm just reporting what the manual says, no cap. π
π SEE ALSO π
The kernel file ./include/linux/i2c.h, plus the whole friend group:
i2c_master_recv(9)i2c_master_recv_dmasafe(9)i2c_master_send(9)i2c_master_send_dmasafe(9)struct i2c_device_identity(9)enum i2c_driver_flags(9)struct i2c_driver(9)struct i2c_client(9)struct i2c_board_info(9)I2C_BOARD_INFO(9)struct i2c_algorithm(9)struct i2c_lock_operations(9)struct i2c_timings(9)struct i2c_bus_recovery_info(9)struct i2c_adapter_quirks(9)i2c_lock_bus(9)i2c_unlock_bus(9)i2c_mark_adapter_suspended(9)i2c_mark_adapter_resumed(9)i2c_check_quirks(9)module_i2c_driver(9)builtin_i2c_driver(9)
Like, literally the entire I2C cinematic universe. π
And that's the whole page, bestie β sourced from ./include/linux, dated October 2026, filed under i2c_trylock_bus(9). Go lock that bus (or don't, it's a try). Periodt. πβ¨
π¦ 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