iio_device_set_parent(9)
π 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 afterdevm_iio_device_allocand beforeiio_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:
- Kernel file
./include/linux/iio/iio.h struct iio_chan_spec_ext_info(9)struct iio_enum(9)IIO_ENUM(9)IIO_ENUM_AVAILABLE(9)struct iio_mount_matrix(9)IIO_MOUNT_MATRIX(9)struct iio_event_spec(9)IIO_SCAN_FORMAT_SIGNED_INT(9)IIO_SCAN_FORMAT_UNSIGNED_INT(9)IIO_SCAN_FORMAT_FLOAT(9)struct iio_scan_type(9)struct iio_chan_spec(9)iio_channel_has_info(9)iio_channel_has_available(9)struct iio_info(9)struct iio_buffer_setup_ops(9)struct iio_dev(9)iio_device_register(9)devm_iio_device_register(9)iio_device_claim_direct(9)iio_device_release_direct(9)iio_device_try_claim_buffer_mode(9)iio_device_release_buffer_mode(9)IIO_DEV_ACQUIRE_DIRECT_MODE(9)IIO_DEV_ACQUIRE_FAILED(9)IIO_DEV_GUARD_CURRENT_MODE(9)iio_device_put(9)dev_to_iio_dev(9)iio_device_get(9)iio_device_set_drvdata(9)iio_device_get_drvdata(9)IIO_DECLARE_BUFFER_WITH_TS(9)IIO_DECLARE_DMA_BUFFER_WITH_TS(9)IIO_DECLARE_QUATERNION(9)iio_get_debugfs_dentry(9)iio_device_suspend_triggering(9)iio_device_resume_triggering(9)iio_get_current_scan_type(9)iio_get_masklength(9)iio_for_each_active_channel(9)IIO_DEGREE_TO_RAD(9)IIO_RAD_TO_DEGREE(9)IIO_G_TO_M_S_2(9)IIO_M_S_2_TO_G(9)
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
- 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