STRUCT I2C_OF_PROBE_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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_DEFER since 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 in free_resourcs_late instead. (that's the spelling in the source, bestie β€” not me, i promise πŸ™ˆ)
  • cleanup β€” the opposite of enable, there to balance refcounts and free resources after probing. it should check if resources were already freed by cleanup_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