iio_device_set_parent(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… iio_device_set_parent β€” the Kernel API Manual, bestie edition πŸŽ€

okay so this is a page from the Kernel API Manual (section 9, the kernel API section, iykyk) and it's about one tiny but lowkey crucial helper. buckle up πŸ’–


✨ NAME ✨

iio_device_set_parent β€” assign parent device to the IIO device object 🫢

🌸 SYNOPSIS 🌸

void iio_device_set_parent (struct iio_dev *indio_dev , struct device
*parent );

that's it. that's the whole signature. two pointers, zero returns, iconic. πŸ‘‘

πŸ¦‹ ARGUMENTS πŸ¦‹

  • indio_dev β€” IIO device structure πŸ’« (the one you're reparenting, the main character)
  • parent β€” reference to parent device object πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the vibe check on when you're allowed to call this. This utility must be called between IIO device allocation (via devm_iio_device_alloc) & IIO device registration (via iio_device_register and devm_iio_device_register). no cap β€” the window is literally just that gap. squeeze it in there. ✨

By default, the device allocation will also assign a parent device to the IIO device object. so like, you don't even have to think about it most of the time.

In cases where devm_iio_device_alloc is used, sometimes the parent device must be different than the device used to manage the allocation. πŸ™ˆ (yes, the thing managing your memory and the thing you call "parent" can be two separate people. it's giving found family, honestly.)

In that case, this helper should be used to change the parent, hence the requirement to call this between allocation & registration. πŸŽ€

too real bestie: call it after devm_iio_device_alloc and before iio_device_register / devm_iio_device_register. any other time and you're just doing too much. πŸ’€

🌈 SEE ALSO 🌈

so the page points you at Kernel file ./include/linux/iio/iio.h and then a whole friend group of related entries β€” seriously, it's a group chat and everyone's here:

like, that's the whole extended universe fr fr. πŸ“


and that's the page bestie!! 🧚 the source is ./include/linux/iio, this version is dated October 2026, and the page wraps up right back at iio_device_set_parent(9) where we started β€” full circle, periodt. πŸ’…πŸ’–

πŸ“¦ where this page comes from