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.

Dependency Surface

Detected Declarations

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

Implementation Notes