i2c_verify_adapter(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ i2c_verify_adapter(9) β€” the kernel API manual, but make it make sense

okay bestie, welcome to i2c_verify_adapter(9), the kernel API manual entry that is genuinely about to save you from a very embarrassing crash. this is the section 9 page, so it's kernel-internal stuff, not your regular command-line situation. let's get into it 🫢


✨ NAME ✨

i2c_verify_adapter β€” literally just returns your parameter back as an i2c_adapter, or hands you NULL if it's not one. that's the whole job. icon behavior honestly πŸ‘‘


🌸 SYNOPSIS 🌸

struct i2c_adapter * i2c_verify_adapter (struct device *dev );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” a device, and it's probably coming at you from some driver model iterator. like, that's the vibe it usually arrives with. you don't actually know what it is yet, and that's kind of the whole plot πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

so, picture this: you're traversing the driver model tree, maybe using driver model iterators like device_for_each_child, and ngl you can't assume very much about the nodes you find. the tree does not owe you type safety. it does not text back. it just gives you devices and hopes for the best 😭

so use this function to avoid oopses caused by wrongly treating some non-I2C device as an i2c_adapter. like, do not just assume every node you bump into is your I2C adapter bestie. that's how you get an oops. that's how you get a bad time. check first, slay after. ✨

bestie please run the vibe check before you cast. this function is the vibe check. πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

the kernel file lives at ./drivers/i2c/i2c-core-base.c, and here's the whole friend group β€” go say hi, they all have their own pages:


and that's the page! πŸ’– this lil beauty comes from ./drivers/i2c and it's dated October 2026 β€” so go forth, verify your adapters, and don't oops. mwah πŸŽ€πŸ¦‹β­

πŸ“¦ where this page comes from