i2c_new_client_device(9)
β¨ i2c_new_client_device(9) β¨
okay bestie, welcome to the Kernel API Manual π
this page is all about i2c_new_client_device, and she is literally the moment you instantiate an i2c device. no cap.
π NAME π
i2c_new_client_device β instantiate an i2c device β¨
π¦ SYNOPSIS π¦
struct i2c_client * i2c_new_client_device (struct i2c_adapter *adap ,
struct i2c_board_info const *info );
πΈ ARGUMENTS πΈ
adapβ the adapter that's managing the device, she's in charge here πinfoβ describes one I2C device;bus_numis ignored, like literally don't worry about it π
π CONTEXT π
can sleep π΄ β so she's not in some frantic atomic rush, okay? give her a minute, she's fine.
π DESCRIPTION π
okay so this function creates an i2c device. the binding situation is handled through driver model probe/remove methods, and that's just how it goes.
here's the thing bestie: a driver may already be bound to this device when we return from this function, or it could happen at any later moment (e.g. maybe hotplugging will load the driver module). so don't assume it's instantaneous, but also don't assume it's not. she's mysterious like that β¨
this call is not appropriate for mainboard initialization logic, and I need you to hear me on this β mainboard init logic usually runs during an arch_initcall long before any i2c_adapter could exist. so like, wrong place, wrong time, not the vibe π
this returns the new i2c client, which may be saved for later use with i2c_unregister_device; or an ERR_PTR to describe the error. and that's the whole tea, periodt.
π SEE ALSO π
the kernel file for this one is ./drivers/i2c/i2c-core-base.c and honestly she has a whole friend group, so here's everyone:
i2c_verify_client(9)i2c_adapter_lock_bus(9)i2c_adapter_trylock_bus(9)i2c_adapter_unlock_bus(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_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)
mwah π this page is from the ./drivers/i2c corner of the Kernel API Manual, dated October 2026, and she ate, no crumbs π
π¦ 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