STRUCT I2C_OF_PROBE_OPS(9)
β¨ struct i2c_of_probe_ops(9) β¨
okay bestie, welcome to the Kernel API Manual β today we're doing struct i2c_of_probe_ops, and it's literally the I2C OF component prober callbacks. yes. that. stay with me π
π NAME π
struct i2c_of_probe_ops β the I2C OF component prober callbacks, aka the three little functions that do all the work π«Ά
πΈ SYNOPSIS πΈ
struct i2c_of_probe_ops {
int (*enable)(struct device *dev, struct device_node *bus_node, void *data);
void (*cleanup_early)(struct device *dev, void *data);
void (*cleanup)(struct device *dev, void *data);
};
like, that's the whole vibe. three function pointers. immaculate. β¨
π Members π
enableβ retrieve and enable resources so that the components respond to probes. it is OK for this callback to return-EPROBE_DEFERsince the intended use includes retrieving resources and enables them (yes really, that's allowed, no cap). but if this fails, resources should be reverted to their initial state and released before returning. clean up your mess before you leave the group chat, periodt πcleanup_earlyβ release exclusive resources prior to calling probe on a detected component. it's only called if a matching component is actually found. if none are found, the resources that would have been released in this callback should be released infree_resourcs_lateinstead. (that's the spelling in the source, bestie β not me, i promise π)cleanupβ the opposite ofenable, there to balance refcounts and free resources after probing. it should check if resources were already freed bycleanup_early. like, don't double-free, that's not the vibe π«Ά
π¦ Description π¦
so this is a set of callbacks to be used by i2c_of_probe_component. main character energy, honestly.
all callbacks are optional. all of them. no pressure, you don't have to fill in every one π
callbacks are called only once per run, and they're used in the order they are defined in this structure. order matters, iykyk.
all callbacks that have return values shall return 0 on success, or a negative error number on failure. simple as that.
the dev parameter passed to the callbacks is the same as dev passed to i2c_of_probe_component. it should only be used for dev_printk calls and nothing else β especially not managed device resource (devres) APIs. like, hands off the devres stuff, that's not what dev is here for π«
π SEE ALSO π
- kernel file
./include/linux/i2c-of-prober.h struct i2c_of_probe_cfg(9)I2C OF component prober simple helpers(9)struct i2c_of_probe_simple_opts(9)
ok that's the whole page and honestly? iconic. go read the actual header file if you need more, bestie π
and that's a wrap, butterfly π¦ this lil slice of the manual lives in ./include/linux and is dated October 2026, filed forever under struct i2c_of_probe_ops(9) β slay, bye π
β¨
π¦ 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