i2c_new_client_device(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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_num is 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:


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