__iio_dev_mode_lock(9)
β¨ __iio_dev_mode_lock β the Kernel API Manual page you've been waiting for β¨
okay so bestie, welcome to the Kernel API Manual entry for __iio_dev_mode_lock. it's short, it's spicy, and it has OPINIONS. let's get into it π«Ά
πΈ NAME πΈ
__iio_dev_mode_lock β locks the current IIO device mode. that's it. that's the whole vibe check. π
π¦ SYNOPSIS π¦
void __iio_dev_mode_lock(struct iio_dev *indio_dev);
literally one function, one argument, returns nothing (void), no cap. π
π ARGUMENTS π
indio_devβ theiio_devthat's associated with the device. that's the one you're locking, bestie, the main character of this whole operation π
π DESCRIPTION π
okay so here's the tea β β if the device is either in direct mode or buffer mode, it is guaranteed to stay that way until __iio_dev_mode_unlock gets called. like, locked in. periodt. π
β οΈ but listen β this function is not meant to be used directly by drivers to protect internal state. if you're a driver and you need to guard your own internal state, you should have your own mechanisms for that matter. this is not your personal bodyguard, it's a mode locker. π
and ngl, there are very few cases where a driver actually needs to lock the current mode unconditionally. like, rare rare. so instead, it's recommended that you use iio_device_claim_direct or the iio_device_try_claim_buffer_mode pairs, or related helpers. those are the icons, use those πβ¨
π§ SEE ALSO π§
kernel file ./drivers/iio/industrialio-core.c β that's where the magic lives, go read it iykyk π
and the whole friend group:
iio_device_id(9)iio_buffer_enabled(9)iio_find_channel_from_si(9)iio_device_set_clock(9)iio_device_get_clock(9)iio_get_time_ns(9)iio_read_mount_matrix(9)iio_format_value(9)__iio_str_to_fixpoint(9)iio_str_to_fixpoint(9)iio_free_chan_devattr_list(9)iio_device_alloc(9)iio_device_free(9)devm_iio_device_alloc(9)iio_chrdev_open(9)iio_chrdev_release(9)iio_active_scan_mask_index(9)iio_device_unregister(9)__iio_dev_mode_unlock(9)iio_device_get_current_mode(9)
π sign-off π
this page lives in ./drivers/iio, it's dated October 2026, and it goes by __iio_dev_mode_lock(9) β go forth and lock responsibly, bestie. slay π
πππ¦β
π¦ 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