Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249861
b: refs/heads/master
c: b9c4451
h: refs/heads/master
i:
  249859: 165937d
v: v3
  • Loading branch information
Michael Hennerich authored and Greg Kroah-Hartman committed May 19, 2011
1 parent 1697117 commit 5186b67
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b2fdd192fede94d88e2e31826031e759f30908e
refs/heads/master: b9c445155e0bc805f0f668fd32ec4a3e808931fe
38 changes: 19 additions & 19 deletions trunk/drivers/staging/iio/adc/ad7606_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,24 @@ static int ad7606_scan_direct(struct ad7606_state *st, unsigned ch)
return ret;
}

static int ad7606_read_raw(struct iio_dev *dev_info,
static int ad7606_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long m)
{
int ret;
struct ad7606_state *st = dev_info->dev_data;
struct ad7606_state *st = indio_dev->dev_data;
unsigned int scale_uv;

switch (m) {
case 0:
mutex_lock(&dev_info->mlock);
if (iio_ring_enabled(dev_info))
mutex_lock(&indio_dev->mlock);
if (iio_ring_enabled(indio_dev))
ret = ad7606_scan_from_ring(st, chan->address);
else
ret = ad7606_scan_direct(st, chan->address);
mutex_unlock(&dev_info->mlock);
mutex_unlock(&indio_dev->mlock);

if (ret < 0)
return ret;
Expand All @@ -114,17 +114,17 @@ static int ad7606_read_raw(struct iio_dev *dev_info,
static ssize_t ad7606_show_range(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct iio_dev *dev_info = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(dev_info);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(indio_dev);

return sprintf(buf, "%u\n", st->range);
}

static ssize_t ad7606_store_range(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct iio_dev *dev_info = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(dev_info);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(indio_dev);
unsigned long lval;

if (strict_strtoul(buf, 10, &lval))
Expand All @@ -133,10 +133,10 @@ static ssize_t ad7606_store_range(struct device *dev,
dev_err(dev, "range is not supported\n");
return -EINVAL;
}
mutex_lock(&dev_info->mlock);
mutex_lock(&indio_dev->mlock);
gpio_set_value(st->pdata->gpio_range, lval == 10000);
st->range = lval;
mutex_unlock(&dev_info->mlock);
mutex_unlock(&indio_dev->mlock);

return count;
}
Expand All @@ -148,8 +148,8 @@ static IIO_CONST_ATTR(range_available, "5000 10000");
static ssize_t ad7606_show_oversampling_ratio(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct iio_dev *dev_info = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(dev_info);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(indio_dev);

return sprintf(buf, "%u\n", st->oversampling);
}
Expand All @@ -169,8 +169,8 @@ static int ad7606_oversampling_get_index(unsigned val)
static ssize_t ad7606_store_oversampling_ratio(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct iio_dev *dev_info = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(dev_info);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(indio_dev);
unsigned long lval;
int ret;

Expand All @@ -183,12 +183,12 @@ static ssize_t ad7606_store_oversampling_ratio(struct device *dev,
return ret;
}

mutex_lock(&dev_info->mlock);
mutex_lock(&indio_dev->mlock);
gpio_set_value(st->pdata->gpio_os0, (ret >> 0) & 1);
gpio_set_value(st->pdata->gpio_os1, (ret >> 1) & 1);
gpio_set_value(st->pdata->gpio_os1, (ret >> 2) & 1);
st->oversampling = lval;
mutex_unlock(&dev_info->mlock);
mutex_unlock(&indio_dev->mlock);

return count;
}
Expand All @@ -210,8 +210,8 @@ static mode_t ad7606_attr_is_visible(struct kobject *kobj,
struct attribute *attr, int n)
{
struct device *dev = container_of(kobj, struct device, kobj);
struct iio_dev *dev_info = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(dev_info);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad7606_state *st = iio_dev_get_devdata(indio_dev);

mode_t mode = attr->mode;

Expand Down

0 comments on commit 5186b67

Please sign in to comment.