include/linux/iio/iio.h
Source file repositories/reference/linux-study-clean/include/linux/iio/iio.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/iio/iio.h- Extension
.h- Size
- 39956 bytes
- Lines
- 1107
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/align.hlinux/device.hlinux/cdev.hlinux/cleanup.hlinux/compiler_types.hlinux/minmax.hlinux/slab.hlinux/iio/types.h
Detected Declarations
struct fwnode_reference_argsstruct iio_chan_specstruct iio_devstruct iio_chan_spec_ext_infostruct iio_enumstruct iio_mount_matrixstruct iio_event_specstruct iio_scan_typestruct iio_chan_specstruct iio_val_int_plus_microstruct iio_triggerstruct iio_infostruct iio_buffer_setup_opsstruct iio_devenum iio_shared_byenum iio_endianfunction iio_channel_has_infofunction iio_channel_has_availablefunction __acquiresfunction iio_device_release_directfunction IIO_DEV_ACQUIRE_DIRECT_MODEfunction iio_device_putfunction dev_to_iio_devfunction iio_device_getfunction iio_device_set_parentfunction iio_device_set_drvdatafunction iio_device_get_drvdatafunction iio_read_acpi_mount_matrixfunction iio_get_acpi_device_name_and_datafunction iio_get_masklength
Annotated Snippet
extern const struct bus_type iio_bus_type;
/**
* iio_device_put() - reference counted deallocation of struct device
* @indio_dev: IIO device structure containing the device
**/
static inline void iio_device_put(struct iio_dev *indio_dev)
{
if (indio_dev)
put_device(&indio_dev->dev);
}
clockid_t iio_device_get_clock(const struct iio_dev *indio_dev);
int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id);
/**
* dev_to_iio_dev() - Get IIO device struct from a device struct
* @dev: The device embedded in the IIO device
*
* Note: The device must be a IIO device, otherwise the result is undefined.
*/
static inline struct iio_dev *dev_to_iio_dev(struct device *dev)
{
return container_of(dev, struct iio_dev, dev);
}
/**
* iio_device_get() - increment reference count for the device
* @indio_dev: IIO device structure
*
* Returns: The passed IIO device
**/
static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev)
{
return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
}
/**
* iio_device_set_parent() - assign parent device to the IIO device object
* @indio_dev: IIO device structure
* @parent: reference to parent device object
*
* 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())).
* By default, the device allocation will also assign a parent device to
* the IIO device object. In cases where devm_iio_device_alloc() is used,
* sometimes the parent device must be different than the device used to
* manage the allocation.
* In that case, this helper should be used to change the parent, hence the
* requirement to call this between allocation & registration.
**/
static inline void iio_device_set_parent(struct iio_dev *indio_dev,
struct device *parent)
{
indio_dev->dev.parent = parent;
}
/**
* iio_device_set_drvdata() - Set device driver data
* @indio_dev: IIO device structure
* @data: Driver specific data
*
* Allows to attach an arbitrary pointer to an IIO device, which can later be
* retrieved by iio_device_get_drvdata().
*/
static inline void iio_device_set_drvdata(struct iio_dev *indio_dev, void *data)
{
dev_set_drvdata(&indio_dev->dev, data);
}
/**
* iio_device_get_drvdata() - Get device driver data
* @indio_dev: IIO device structure
*
* Returns the data previously set with iio_device_set_drvdata()
*/
static inline void *iio_device_get_drvdata(const struct iio_dev *indio_dev)
{
return dev_get_drvdata(&indio_dev->dev);
}
/*
* Used to ensure the iio_priv() structure is aligned to allow that structure
* to in turn include IIO_DMA_MINALIGN'd elements such as buffers which
* must not share cachelines with the rest of the structure, thus making
* them safe for use with non-coherent DMA.
*
* A number of drivers also use this on buffers that include a 64-bit timestamp
* that is used with iio_push_to_buffers_with_ts(). Therefore, in the case where
Annotation
- Immediate include surface: `linux/align.h`, `linux/device.h`, `linux/cdev.h`, `linux/cleanup.h`, `linux/compiler_types.h`, `linux/minmax.h`, `linux/slab.h`, `linux/iio/types.h`.
- Detected declarations: `struct fwnode_reference_args`, `struct iio_chan_spec`, `struct iio_dev`, `struct iio_chan_spec_ext_info`, `struct iio_enum`, `struct iio_mount_matrix`, `struct iio_event_spec`, `struct iio_scan_type`, `struct iio_chan_spec`, `struct iio_val_int_plus_micro`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.