i3c_bus_for_each_i2cdev(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… i3c_bus_for_each_i2cdev β€” a lil' field guide (from the Kernel API Manual, bestie) πŸŽ€

okay so picture this: you're deep in the kernel, you've got an I3C bus, and you need to walk every single I2C device chillin' on it. that's literally this macro. it's giving "loop, but make it official." ✨


🌸 NAME 🌸

i3c_bus_for_each_i2cdev β€” iterate over all I2C devices present on the bus πŸ¦‹

like. all of them. no cap. you point it at the bus, it hands you each I2C device in turn, one at a time, no skipping, no shortcuts. main character iteration energy honestly πŸ‘‘


✨ SYNOPSIS ✨

i3c_bus_for_each_i2cdev (bus , dev );

yes the spacing is exactly like that, don't come for me, I don't make the rules πŸ’… (okay the kernel makes the rules, but still)


🫢 ARGUMENTS 🫢

  • bus β€” the I3C bus 🌈 like, the actual bus you're walking through. this is the whole venue, the party you're doing the rounds at.
  • dev β€” an I2C device descriptor pointer, and here's the cute part: it gets updated to point to the current slot at each iteration of the loop. so every trip around the loop, dev is refreshed to whoever's up next. it's a little rotating spotlight, honestly. πŸ”₯
ngl, dev is doing the real work here β€” it's not just "a pointer", it's the pointer that moves. keep an eye on it. πŸ‘€

πŸ’– DESCRIPTION πŸ’–

Iterate over all I2C devs present on the bus.

that's it. that's the whole vibe. you loop, you get every I2C device on the bus, one by one, and dev keeps up with where you are. simple, iconic, does exactly what it says on the tin. πŸ“


πŸ¦‹ SEE ALSO πŸ¦‹

the kernel file to peek at is ./include/linux/i3c/master.h β€” that's where the magic lives, bestie πŸ“‚

and here's the whole friend group, all of them, in order, because we don't leave anyone out at this lunch table:


πŸ’€ real talk: this is a kernel API page, so it's like the source of truth β€” but it only tells you what's documented here. don't go inventing behavior that isn't written down, that's not slay, that's just guessing πŸ™ˆ

and that's the page!! mwah πŸ’‹

so yeah, this lil' writeup came from the source file ./include/linux/i3c, and the version/date on it is October 2026. page title's i3c_bus_for_each_i2cdev(9), in case you forgot already (you didn't, you're doing amazing 🫢). go iterate something. periodt. πŸŒˆβ­πŸ’œ

πŸ“¦ where this page comes from