linux/drivers/iio/industrialio-event.c

// SPDX-License-Identifier: GPL-2.0-only
/* Industrial I/O event handling
 *
 * Copyright (c) 2008 Jonathan Cameron
 *
 * Based on elements of hwmon and input subsystems.
 */

#include <linux/anon_inodes.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/kfifo.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/wait.h>
#include <linux/iio/iio.h>
#include <linux/iio/iio-opaque.h>
#include "iio_core.h"
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>

/**
 * struct iio_event_interface - chrdev interface for an event line
 * @wait:		wait queue to allow blocking reads of events
 * @det_events:		list of detected events
 * @dev_attr_list:	list of event interface sysfs attribute
 * @flags:		file operations related flags including busy flag.
 * @group:		event interface sysfs attribute group
 * @read_lock:		lock to protect kfifo read operations
 * @ioctl_handler:	handler for event ioctl() calls
 */
struct iio_event_interface {};

bool iio_event_enabled(const struct iio_event_interface *ev_int)
{}

/**
 * iio_push_event() - try to add event to the list for userspace reading
 * @indio_dev:		IIO device structure
 * @ev_code:		What event
 * @timestamp:		When the event occurred
 *
 * Note: The caller must make sure that this function is not running
 * concurrently for the same indio_dev more than once.
 *
 * This function may be safely used as soon as a valid reference to iio_dev has
 * been obtained via iio_device_alloc(), but any events that are submitted
 * before iio_device_register() has successfully completed will be silently
 * discarded.
 **/
int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp)
{}
EXPORT_SYMBOL();

/**
 * iio_event_poll() - poll the event queue to find out if it has data
 * @filep:	File structure pointer to identify the device
 * @wait:	Poll table pointer to add the wait queue on
 *
 * Return: (EPOLLIN | EPOLLRDNORM) if data is available for reading
 *	   or a negative error code on failure
 */
static __poll_t iio_event_poll(struct file *filep,
			     struct poll_table_struct *wait)
{}

static ssize_t iio_event_chrdev_read(struct file *filep,
				     char __user *buf,
				     size_t count,
				     loff_t *f_ps)
{}

static int iio_event_chrdev_release(struct inode *inode, struct file *filep)
{}

static const struct file_operations iio_event_chrdev_fileops =;

static int iio_event_getfd(struct iio_dev *indio_dev)
{}

static const char * const iio_ev_type_text[] =;

static const char * const iio_ev_dir_text[] =;

static const char * const iio_ev_info_text[] =;

static enum iio_event_direction iio_ev_attr_dir(struct iio_dev_attr *attr)
{}

static enum iio_event_type iio_ev_attr_type(struct iio_dev_attr *attr)
{}

static enum iio_event_info iio_ev_attr_info(struct iio_dev_attr *attr)
{}

static ssize_t iio_ev_state_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf,
				  size_t len)
{}

static ssize_t iio_ev_state_show(struct device *dev,
				 struct device_attribute *attr,
				 char *buf)
{}

static ssize_t iio_ev_value_show(struct device *dev,
				 struct device_attribute *attr,
				 char *buf)
{}

static ssize_t iio_ev_value_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf,
				  size_t len)
{}

static ssize_t iio_ev_label_show(struct device *dev,
				 struct device_attribute *attr,
				 char *buf)
{}

static int iio_device_add_event(struct iio_dev *indio_dev,
	const struct iio_chan_spec *chan, unsigned int spec_index,
	enum iio_event_type type, enum iio_event_direction dir,
	enum iio_shared_by shared_by, const unsigned long *mask)
{}

static int iio_device_add_event_label(struct iio_dev *indio_dev,
				      const struct iio_chan_spec *chan,
				      unsigned int spec_index,
				      enum iio_event_type type,
				      enum iio_event_direction dir)
{}

static int iio_device_add_event_sysfs(struct iio_dev *indio_dev,
	struct iio_chan_spec const *chan)
{}

static inline int __iio_add_event_config_attrs(struct iio_dev *indio_dev)
{}

static bool iio_check_for_dynamic_events(struct iio_dev *indio_dev)
{}

static void iio_setup_ev_int(struct iio_event_interface *ev_int)
{}

static long iio_event_ioctl(struct iio_dev *indio_dev, struct file *filp,
			    unsigned int cmd, unsigned long arg)
{}

static const char *iio_event_group_name =;
int iio_device_register_eventset(struct iio_dev *indio_dev)
{}

/**
 * iio_device_wakeup_eventset - Wakes up the event waitqueue
 * @indio_dev: The IIO device
 *
 * Wakes up the event waitqueue used for poll() and blocking read().
 * Should usually be called when the device is unregistered.
 */
void iio_device_wakeup_eventset(struct iio_dev *indio_dev)
{}

void iio_device_unregister_eventset(struct iio_dev *indio_dev)
{}