i2c_adapter_lock_bus(9)
π i2c_adapter_lock_bus(9) β like, the Kernel API Manual bestie edition π
okay so picture this: you're in the Kernel API Manual (yes that's the whole manual, we're fancy here β¨) and you need exclusive access to an I2C bus segment. no sharing, no "just one more client", nobody else touching it. that's literally this function. it's giving bouncer-at-the-club energy π
β¨ NAME β¨
i2c_adapter_lock_bus β get exclusive access to an I2C bus segment π¦
like, you're claiming the whole vibe for yourself. no cap.
πΈ SYNOPSIS πΈ
void i2c_adapter_lock_bus(struct i2c_adapter *adapter, unsigned int flags);
she takes two things and returns void, which means she doesn't hand you anything back β the lock itself is the prize π
π«Ά ARGUMENTS π«Ά
adapterβ the target I2C bus segment π like, which bus are we locking down, bestie? this is the one.flagsβ the important little switch that decides how much you're locking, and it's lowkey a big deal:I2C_LOCK_ROOT_ADAPTERβ locks the root i2c adapter π the whole tree from the top, main character style.I2C_LOCK_SEGMENTβ locks only this branch in the adapter tree πΏ just your little corner, not the whole family.
ngl, the difference between those two is the whole plot of this function. pick the right one or you're locking way more (or way less) than you meant to π
π₯ SEE ALSO π₯
Kernel file ./drivers/i2c/i2c-core-base.c β the source, the origin story, the blueprint π§
and the whole squad, aka the friend group of related calls:
i2c_verify_client(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_get_dma_safe_msg_buf(9)i2c_put_dma_safe_msg_buf(9)
pro tip from me to you: if you grabbed a lock, i2c_adapter_unlock_bus(9) exists for a reason, babes. don't be that person π
and that's the whole page, bestie π you ate. this one lives under ./drivers/i2c and it's dated October 2026 β so like... future iconic. 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