i2c_verify_adapter(9)
π 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:
i2c_verify_client(9)i2c_adapter_lock_bus(9)i2c_adapter_trylock_bus(9)i2c_adapter_unlock_bus(9)i2c_new_client_device(9)i2c_unregister_device(9)i2c_find_device_by_fwnode(9)i2c_new_dummy_device(9)devm_i2c_new_dummy_device(9)i2c_new_ancillary_device(9)i2c_handle_smbus_host_notify(9)i2c_add_adapter(9)i2c_add_numbered_adapter(9)i2c_del_adapter(9)devm_i2c_add_adapter(9)i2c_find_adapter_by_fwnode(9)i2c_get_adapter_by_fwnode(9)i2c_parse_fw_timings(9)i2c_del_driver(9)__i2c_transfer(9)i2c_transfer(9)i2c_transfer_buffer_flags(9)i2c_get_device_id(9)i2c_client_get_device_id(9)i2c_get_dma_safe_msg_buf(9)i2c_put_dma_safe_msg_buf(9)
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
- 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