*/
#include <linux/interrupt.h>
-#include <linux/workqueue.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
-#include <linux/list.h>
#include <linux/regulator/consumer.h>
#include <linux/err.h>
#include <linux/gpio.h>
return -ENODEV;
}
-static int ad7606_scan_direct(struct ad7606_state *st, unsigned ch)
+static int ad7606_scan_direct(struct iio_dev *indio_dev, unsigned ch)
{
+ struct ad7606_state *st = iio_priv(indio_dev);
int ret;
st->done = false;
long m)
{
int ret;
- struct ad7606_state *st = indio_dev->dev_data;
+ struct ad7606_state *st = iio_priv(indio_dev);
unsigned int scale_uv;
switch (m) {
case 0:
mutex_lock(&indio_dev->mlock);
if (iio_ring_enabled(indio_dev))
- ret = ad7606_scan_from_ring(st, chan->address);
+ ret = ad7606_scan_from_ring(indio_dev, chan->address);
else
- ret = ad7606_scan_direct(st, chan->address);
+ ret = ad7606_scan_direct(indio_dev, chan->address);
mutex_unlock(&indio_dev->mlock);
if (ret < 0)
struct device_attribute *attr, char *buf)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ad7606_state *st = iio_dev_get_devdata(indio_dev);
+ struct ad7606_state *st = iio_priv(indio_dev);
return sprintf(buf, "%u\n", st->range);
}
struct device_attribute *attr, const char *buf, size_t count)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ad7606_state *st = iio_dev_get_devdata(indio_dev);
+ struct ad7606_state *st = iio_priv(indio_dev);
unsigned long lval;
if (strict_strtoul(buf, 10, &lval))
struct device_attribute *attr, char *buf)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ad7606_state *st = iio_dev_get_devdata(indio_dev);
+ struct ad7606_state *st = iio_priv(indio_dev);
return sprintf(buf, "%u\n", st->oversampling);
}
struct device_attribute *attr, const char *buf, size_t count)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ad7606_state *st = iio_dev_get_devdata(indio_dev);
+ struct ad7606_state *st = iio_priv(indio_dev);
unsigned long lval;
int ret;
{
struct device *dev = container_of(kobj, struct device, kobj);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ad7606_state *st = iio_dev_get_devdata(indio_dev);
+ struct ad7606_state *st = iio_priv(indio_dev);
mode_t mode = attr->mode;
indio_dev->dev.parent = dev;
indio_dev->attrs = &ad7606_attribute_group;
- indio_dev->dev_data = (void *)(st);
indio_dev->driver_module = THIS_MODULE;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->name = st->chip_info->name;
#include <linux/interrupt.h>
#include <linux/gpio.h>
-#include <linux/workqueue.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include "ad7606.h"
-int ad7606_scan_from_ring(struct ad7606_state *st, unsigned ch)
+int ad7606_scan_from_ring(struct iio_dev *indio_dev, unsigned ch)
{
- struct iio_ring_buffer *ring = iio_priv_to_dev(st)->ring;
+ struct iio_ring_buffer *ring = indio_dev->ring;
int ret;
u16 *ring_data;
**/
static int ad7606_ring_preenable(struct iio_dev *indio_dev)
{
- struct ad7606_state *st = indio_dev->dev_data;
+ struct ad7606_state *st = iio_priv(indio_dev);
struct iio_ring_buffer *ring = indio_dev->ring;
size_t d_size;
{
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->private_data;
- struct ad7606_state *st = indio_dev->dev_data;
+ struct ad7606_state *st = iio_priv(indio_dev);
gpio_set_value(st->pdata->gpio_convst, 1);
int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev)
{
- struct ad7606_state *st = indio_dev->dev_data;
+ struct ad7606_state *st = iio_priv(indio_dev);
int ret;
indio_dev->ring = iio_sw_rb_allocate(indio_dev);