i2c_adapter_lock_bus(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:

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