i2c_find_device_by_fwnode(9)
π i2c_find_device_by_fwnode β¨
okay bestie, so this is a page from the Kernel API Manual (yes, the Kernel API Manual, we're in the big leagues now π«Ά), and it's all about one very specific little lookup function. it's short, it's sweet, and it's lowkey important. let's get into it π
πΈ NAME πΈ
i2c_find_device_by_fwnode β find an i2c_client for the fwnode. that's it. that's the whole vibe. π
β SYNOPSIS β
struct i2c_client * i2c_find_device_by_fwnode (struct fwnode_handle
*fwnode );
like, you hand it a fwnode, it hands you back a struct i2c_client *. classic trade, no cap π€
π¦ ARGUMENTS π¦
fwnodeβ thestruct fwnode_handlethat corresponds to thestruct i2c_clientyou're chasing. this is your little "hey, this firmware node right here, that's the one" receipt π§Ύβ¨
π DESCRIPTION π
so what does it do? it looks up the struct i2c_client that corresponds to fwnode, and returns it. that's the main character move π
and here's the fine print, because of course there's fine print:
- if no client can be found, it returns
NULLπ« - if
fwnodeisNULL, it also returnsNULLβ so yeah, null in, null out, no drama, no crash π
β οΈ important bestie!! the user must call put_device(client->dev) once you're done with the i2c client. this is not optional, this is not a suggestion, this is the rules. forget it and you're leaking, and not in the cute way π please release your device. periodt π
π SEE ALSO π
the kernel file lives at ./drivers/i2c/i2c-core-base.c β that's home base π
and here's the whole friend group, enjoy the roll call π:
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_new_dummy_device(9)devm_i2c_new_dummy_device(9)i2c_new_ancillary_device(9)i2c_verify_adapter(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)
like, the whole i2c extended universe, fr fr π
aaaand that's the page!! π this one came from ./drivers/i2c, dated October 2026, and it's filed under i2c_find_device_by_fwnode(9). go forth and remember your put_device() bestie, i'm rooting for you π«Άπβ¨
π¦ 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