staging: iio: push the main buffer chrdev down to the top level.
[deliverable/linux.git] / drivers / staging / iio / iio_core.h
CommitLineData
df9c1c42
JC
1/* The industrial I/O core function defs.
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 *
9 * These definitions are meant for use only within the IIO core, not indvidual
10 * drivers.
11 */
12
1aa04278
JC
13#ifndef _IIO_CORE_H_
14#define _IIO_CORE_H_
15
df9c1c42
JC
16/**
17 * iio_device_get_chrdev_minor() - get an unused minor number
18 **/
19int iio_device_get_chrdev_minor(void);
20void iio_device_free_chrdev_minor(int val);
21
22
23/**
24 * iio_put() - internal module reference count reduce
25 **/
26void iio_put(void);
27
28/**
29 * iio_get() - internal module reference count increase
30 **/
31void iio_get(void);
32
33extern dev_t iio_devt;
34
35int __iio_add_chan_devattr(const char *postfix,
36 const char *group,
37 struct iio_chan_spec const *chan,
38 ssize_t (*func)(struct device *dev,
39 struct device_attribute *attr,
40 char *buf),
41 ssize_t (*writefunc)(struct device *dev,
42 struct device_attribute *attr,
43 const char *buf,
44 size_t len),
45 int mask,
46 bool generic,
47 struct device *dev,
48 struct list_head *attr_list);
49
50/* Event interface flags */
51#define IIO_BUSY_BIT_POS 1
1aa04278
JC
52
53#ifdef CONFIG_IIO_RING_BUFFER
54struct poll_table_struct;
55
56void iio_chrdev_ring_open(struct iio_dev *indio_dev);
57void iio_chrdev_ring_release(struct iio_dev *indio_dev);
58
59unsigned int iio_ring_poll(struct file *filp,
60 struct poll_table_struct *wait);
61ssize_t iio_ring_read_first_n_outer(struct file *filp, char __user *buf,
62 size_t n, loff_t *f_ps);
63
64
65#define iio_ring_poll_addr (&iio_ring_poll)
66#define iio_ring_read_first_n_outer_addr (&iio_ring_read_first_n_outer)
67
68#else
69
70static inline void iio_chrdev_ring_open(struct iio_dev *indio_dev)
71{}
72static inline void iio_chrdev_ring_release(struct iio_dev *indio_dev)
73{}
74
75#define iio_ring_poll_addr NULL
76#define iio_ring_read_first_n_outer_addr NULL
77
78#endif
79
80#endif
This page took 0.036257 seconds and 5 git commands to generate.