Commit 638e59fc authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:dac/dds/impedance dev_info to indio_dev for consistency

We had a random missmatch of these two.  Lets pick the most common
and get rid of the other.
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>

For adxxxx parts
Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 84f79ecb
...@@ -68,8 +68,8 @@ static ssize_t ad5446_write(struct device *dev, ...@@ -68,8 +68,8 @@ static ssize_t ad5446_write(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5446_state *st = iio_priv(dev_info); struct ad5446_state *st = iio_priv(indio_dev);
int ret; int ret;
long val; long val;
...@@ -82,11 +82,11 @@ static ssize_t ad5446_write(struct device *dev, ...@@ -82,11 +82,11 @@ static ssize_t ad5446_write(struct device *dev,
goto error_ret; goto error_ret;
} }
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
st->cached_val = val; st->cached_val = val;
st->chip_info->store_sample(st, val); st->chip_info->store_sample(st, val);
ret = spi_sync(st->spi, &st->msg); ret = spi_sync(st->spi, &st->msg);
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
error_ret: error_ret:
return ret ? ret : len; return ret ? ret : len;
...@@ -98,8 +98,8 @@ static ssize_t ad5446_show_scale(struct device *dev, ...@@ -98,8 +98,8 @@ static ssize_t ad5446_show_scale(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5446_state *st = iio_priv(dev_info); struct ad5446_state *st = iio_priv(indio_dev);
/* Corresponds to Vref / 2^(bits) */ /* Corresponds to Vref / 2^(bits) */
unsigned int scale_uv = (st->vref_mv * 1000) >> st->chip_info->bits; unsigned int scale_uv = (st->vref_mv * 1000) >> st->chip_info->bits;
...@@ -111,8 +111,8 @@ static ssize_t ad5446_write_powerdown_mode(struct device *dev, ...@@ -111,8 +111,8 @@ static ssize_t ad5446_write_powerdown_mode(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t len) const char *buf, size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5446_state *st = iio_priv(dev_info); struct ad5446_state *st = iio_priv(indio_dev);
if (sysfs_streq(buf, "1kohm_to_gnd")) if (sysfs_streq(buf, "1kohm_to_gnd"))
st->pwr_down_mode = MODE_PWRDWN_1k; st->pwr_down_mode = MODE_PWRDWN_1k;
...@@ -129,8 +129,8 @@ static ssize_t ad5446_write_powerdown_mode(struct device *dev, ...@@ -129,8 +129,8 @@ static ssize_t ad5446_write_powerdown_mode(struct device *dev,
static ssize_t ad5446_read_powerdown_mode(struct device *dev, static ssize_t ad5446_read_powerdown_mode(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5446_state *st = iio_priv(dev_info); struct ad5446_state *st = iio_priv(indio_dev);
char mode[][15] = {"", "1kohm_to_gnd", "100kohm_to_gnd", "three_state"}; char mode[][15] = {"", "1kohm_to_gnd", "100kohm_to_gnd", "three_state"};
...@@ -141,8 +141,8 @@ static ssize_t ad5446_read_dac_powerdown(struct device *dev, ...@@ -141,8 +141,8 @@ static ssize_t ad5446_read_dac_powerdown(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5446_state *st = iio_priv(dev_info); struct ad5446_state *st = iio_priv(indio_dev);
return sprintf(buf, "%d\n", st->pwr_down); return sprintf(buf, "%d\n", st->pwr_down);
} }
...@@ -151,8 +151,8 @@ static ssize_t ad5446_write_dac_powerdown(struct device *dev, ...@@ -151,8 +151,8 @@ static ssize_t ad5446_write_dac_powerdown(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t len) const char *buf, size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5446_state *st = iio_priv(dev_info); struct ad5446_state *st = iio_priv(indio_dev);
unsigned long readin; unsigned long readin;
int ret; int ret;
...@@ -163,7 +163,7 @@ static ssize_t ad5446_write_dac_powerdown(struct device *dev, ...@@ -163,7 +163,7 @@ static ssize_t ad5446_write_dac_powerdown(struct device *dev,
if (readin > 1) if (readin > 1)
ret = -EINVAL; ret = -EINVAL;
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
st->pwr_down = readin; st->pwr_down = readin;
if (st->pwr_down) if (st->pwr_down)
...@@ -172,7 +172,7 @@ static ssize_t ad5446_write_dac_powerdown(struct device *dev, ...@@ -172,7 +172,7 @@ static ssize_t ad5446_write_dac_powerdown(struct device *dev,
st->chip_info->store_sample(st, st->cached_val); st->chip_info->store_sample(st, st->cached_val);
ret = spi_sync(st->spi, &st->msg); ret = spi_sync(st->spi, &st->msg);
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
return ret ? ret : len; return ret ? ret : len;
} }
...@@ -201,8 +201,8 @@ static mode_t ad5446_attr_is_visible(struct kobject *kobj, ...@@ -201,8 +201,8 @@ static mode_t ad5446_attr_is_visible(struct kobject *kobj,
struct attribute *attr, int n) struct attribute *attr, int n)
{ {
struct device *dev = container_of(kobj, struct device, kobj); struct device *dev = container_of(kobj, struct device, kobj);
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5446_state *st = iio_priv(dev_info); struct ad5446_state *st = iio_priv(indio_dev);
mode_t mode = attr->mode; mode_t mode = attr->mode;
......
...@@ -59,8 +59,8 @@ static ssize_t max517_set_value(struct device *dev, ...@@ -59,8 +59,8 @@ static ssize_t max517_set_value(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count, int channel) const char *buf, size_t count, int channel)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct max517_data *data = iio_priv(dev_info); struct max517_data *data = iio_priv(indio_dev);
struct i2c_client *client = data->client; struct i2c_client *client = data->client;
u8 outbuf[4]; /* 1x or 2x command + value */ u8 outbuf[4]; /* 1x or 2x command + value */
int outbuf_size = 0; int outbuf_size = 0;
...@@ -128,8 +128,8 @@ static ssize_t max517_show_scale(struct device *dev, ...@@ -128,8 +128,8 @@ static ssize_t max517_show_scale(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf, int channel) char *buf, int channel)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct max517_data *data = iio_priv(dev_info); struct max517_data *data = iio_priv(indio_dev);
/* Corresponds to Vref / 2^(bits) */ /* Corresponds to Vref / 2^(bits) */
unsigned int scale_uv = (data->vref_mv[channel - 1] * 1000) >> 8; unsigned int scale_uv = (data->vref_mv[channel - 1] * 1000) >> 8;
......
...@@ -77,8 +77,8 @@ static ssize_t ad9832_write(struct device *dev, ...@@ -77,8 +77,8 @@ static ssize_t ad9832_write(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad9832_state *st = iio_priv(dev_info); struct ad9832_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret; int ret;
long val; long val;
...@@ -87,7 +87,7 @@ static ssize_t ad9832_write(struct device *dev, ...@@ -87,7 +87,7 @@ static ssize_t ad9832_write(struct device *dev,
if (ret) if (ret)
goto error_ret; goto error_ret;
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
switch (this_attr->address) { switch (this_attr->address) {
case AD9832_FREQ0HM: case AD9832_FREQ0HM:
case AD9832_FREQ1HM: case AD9832_FREQ1HM:
...@@ -148,7 +148,7 @@ static ssize_t ad9832_write(struct device *dev, ...@@ -148,7 +148,7 @@ static ssize_t ad9832_write(struct device *dev,
default: default:
ret = -ENODEV; ret = -ENODEV;
} }
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
error_ret: error_ret:
return ret ? ret : len; return ret ? ret : len;
......
...@@ -66,8 +66,8 @@ static ssize_t ad9834_write(struct device *dev, ...@@ -66,8 +66,8 @@ static ssize_t ad9834_write(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad9834_state *st = iio_priv(dev_info); struct ad9834_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret; int ret;
long val; long val;
...@@ -76,7 +76,7 @@ static ssize_t ad9834_write(struct device *dev, ...@@ -76,7 +76,7 @@ static ssize_t ad9834_write(struct device *dev,
if (ret) if (ret)
goto error_ret; goto error_ret;
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
switch (this_attr->address) { switch (this_attr->address) {
case AD9834_REG_FREQ0: case AD9834_REG_FREQ0:
case AD9834_REG_FREQ1: case AD9834_REG_FREQ1:
...@@ -134,7 +134,7 @@ static ssize_t ad9834_write(struct device *dev, ...@@ -134,7 +134,7 @@ static ssize_t ad9834_write(struct device *dev,
default: default:
ret = -ENODEV; ret = -ENODEV;
} }
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
error_ret: error_ret:
return ret ? ret : len; return ret ? ret : len;
...@@ -145,13 +145,13 @@ static ssize_t ad9834_store_wavetype(struct device *dev, ...@@ -145,13 +145,13 @@ static ssize_t ad9834_store_wavetype(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad9834_state *st = iio_priv(dev_info); struct ad9834_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret = 0; int ret = 0;
bool is_ad9833_7 = (st->devid == ID_AD9833) || (st->devid == ID_AD9837); bool is_ad9833_7 = (st->devid == ID_AD9833) || (st->devid == ID_AD9837);
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
switch (this_attr->address) { switch (this_attr->address) {
case 0: case 0:
...@@ -194,7 +194,7 @@ static ssize_t ad9834_store_wavetype(struct device *dev, ...@@ -194,7 +194,7 @@ static ssize_t ad9834_store_wavetype(struct device *dev,
st->data = cpu_to_be16(AD9834_REG_CMD | st->control); st->data = cpu_to_be16(AD9834_REG_CMD | st->control);
ret = spi_sync(st->spi, &st->msg); ret = spi_sync(st->spi, &st->msg);
} }
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
return ret ? ret : len; return ret ? ret : len;
} }
...@@ -203,8 +203,8 @@ static ssize_t ad9834_show_out0_wavetype_available(struct device *dev, ...@@ -203,8 +203,8 @@ static ssize_t ad9834_show_out0_wavetype_available(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad9834_state *st = iio_priv(dev_info); struct ad9834_state *st = iio_priv(indio_dev);
char *str; char *str;
if ((st->devid == ID_AD9833) || (st->devid == ID_AD9837)) if ((st->devid == ID_AD9833) || (st->devid == ID_AD9837))
...@@ -225,8 +225,8 @@ static ssize_t ad9834_show_out1_wavetype_available(struct device *dev, ...@@ -225,8 +225,8 @@ static ssize_t ad9834_show_out1_wavetype_available(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad9834_state *st = iio_priv(dev_info); struct ad9834_state *st = iio_priv(indio_dev);
char *str; char *str;
if (st->control & AD9834_MODE) if (st->control & AD9834_MODE)
...@@ -285,8 +285,8 @@ static mode_t ad9834_attr_is_visible(struct kobject *kobj, ...@@ -285,8 +285,8 @@ static mode_t ad9834_attr_is_visible(struct kobject *kobj,
struct attribute *attr, int n) struct attribute *attr, int n)
{ {
struct device *dev = container_of(kobj, struct device, kobj); struct device *dev = container_of(kobj, struct device, kobj);
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad9834_state *st = iio_priv(dev_info); struct ad9834_state *st = iio_priv(indio_dev);
mode_t mode = attr->mode; mode_t mode = attr->mode;
......
...@@ -260,8 +260,8 @@ static ssize_t ad5933_show_frequency(struct device *dev, ...@@ -260,8 +260,8 @@ static ssize_t ad5933_show_frequency(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5933_state *st = iio_priv(dev_info); struct ad5933_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret; int ret;
unsigned long long freqreg; unsigned long long freqreg;
...@@ -270,9 +270,9 @@ static ssize_t ad5933_show_frequency(struct device *dev, ...@@ -270,9 +270,9 @@ static ssize_t ad5933_show_frequency(struct device *dev,
u8 d8[4]; u8 d8[4];
} dat; } dat;
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
ret = ad5933_i2c_read(st->client, this_attr->address, 3, &dat.d8[1]); ret = ad5933_i2c_read(st->client, this_attr->address, 3, &dat.d8[1]);
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -289,8 +289,8 @@ static ssize_t ad5933_store_frequency(struct device *dev, ...@@ -289,8 +289,8 @@ static ssize_t ad5933_store_frequency(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5933_state *st = iio_priv(dev_info); struct ad5933_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
long val; long val;
int ret; int ret;
...@@ -302,9 +302,9 @@ static ssize_t ad5933_store_frequency(struct device *dev, ...@@ -302,9 +302,9 @@ static ssize_t ad5933_store_frequency(struct device *dev,
if (val > AD5933_MAX_OUTPUT_FREQ_Hz) if (val > AD5933_MAX_OUTPUT_FREQ_Hz)
return -EINVAL; return -EINVAL;
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
ret = ad5933_set_freq(st, this_attr->address, val); ret = ad5933_set_freq(st, this_attr->address, val);
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
return ret ? ret : len; return ret ? ret : len;
} }
...@@ -323,12 +323,12 @@ static ssize_t ad5933_show(struct device *dev, ...@@ -323,12 +323,12 @@ static ssize_t ad5933_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5933_state *st = iio_priv(dev_info); struct ad5933_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret = 0, len = 0; int ret = 0, len = 0;
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
switch (this_attr->address) { switch (this_attr->address) {
case AD5933_OUT_RANGE: case AD5933_OUT_RANGE:
len = sprintf(buf, "%d\n", len = sprintf(buf, "%d\n",
...@@ -357,7 +357,7 @@ static ssize_t ad5933_show(struct device *dev, ...@@ -357,7 +357,7 @@ static ssize_t ad5933_show(struct device *dev,
ret = -EINVAL; ret = -EINVAL;
} }
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
return ret ? ret : len; return ret ? ret : len;
} }
...@@ -366,8 +366,8 @@ static ssize_t ad5933_store(struct device *dev, ...@@ -366,8 +366,8 @@ static ssize_t ad5933_store(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5933_state *st = iio_priv(dev_info); struct ad5933_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
long val; long val;
int i, ret = 0; int i, ret = 0;
...@@ -379,7 +379,7 @@ static ssize_t ad5933_store(struct device *dev, ...@@ -379,7 +379,7 @@ static ssize_t ad5933_store(struct device *dev,
return ret; return ret;
} }
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
switch (this_attr->address) { switch (this_attr->address) {
case AD5933_OUT_RANGE: case AD5933_OUT_RANGE:
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
...@@ -428,7 +428,7 @@ static ssize_t ad5933_store(struct device *dev, ...@@ -428,7 +428,7 @@ static ssize_t ad5933_store(struct device *dev,
ret = -EINVAL; ret = -EINVAL;
} }
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
return ret ? ret : len; return ret ? ret : len;
} }
...@@ -483,20 +483,20 @@ static const struct attribute_group ad5933_attribute_group = { ...@@ -483,20 +483,20 @@ static const struct attribute_group ad5933_attribute_group = {
.attrs = ad5933_attributes, .attrs = ad5933_attributes,
}; };
static int ad5933_read_raw(struct iio_dev *dev_info, static int ad5933_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, struct iio_chan_spec const *chan,
int *val, int *val,
int *val2, int *val2,
long m) long m)
{ {
struct ad5933_state *st = iio_priv(dev_info); struct ad5933_state *st = iio_priv(indio_dev);
unsigned short dat; unsigned short dat;
int ret = -EINVAL; int ret = -EINVAL;
mutex_lock(&dev_info->mlock); mutex_lock(&indio_dev->mlock);
switch (m) { switch (m) {
case 0: case 0:
if (iio_buffer_enabled(dev_info)) { if (iio_buffer_enabled(indio_dev)) {
ret = -EBUSY; ret = -EBUSY;
goto out; goto out;
} }
...@@ -512,7 +512,7 @@ static int ad5933_read_raw(struct iio_dev *dev_info, ...@@ -512,7 +512,7 @@ static int ad5933_read_raw(struct iio_dev *dev_info,
(u8 *)&dat); (u8 *)&dat);
if (ret < 0) if (ret < 0)
goto out; goto out;
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
ret = be16_to_cpu(dat); ret = be16_to_cpu(dat);
/* Temp in Milli degrees Celsius */ /* Temp in Milli degrees Celsius */
if (ret < 8192) if (ret < 8192)
...@@ -524,7 +524,7 @@ static int ad5933_read_raw(struct iio_dev *dev_info, ...@@ -524,7 +524,7 @@ static int ad5933_read_raw(struct iio_dev *dev_info,
} }
out: out:
mutex_unlock(&dev_info->mlock); mutex_unlock(&indio_dev->mlock);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment