summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@kernel.org>2012-04-21 10:09:43 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-24 11:23:38 -0700
commitf5ee7b807fc90756d6852690a3777db7093efe0d (patch)
tree64fe29a2979761e6fbf6c1c5fb6dd39eb5a869c5
parentc562ccbf584f8017a153bbd5c1039a189e1f8be8 (diff)
downloadlinux-3.10-f5ee7b807fc90756d6852690a3777db7093efe0d.tar.gz
linux-3.10-f5ee7b807fc90756d6852690a3777db7093efe0d.tar.bz2
linux-3.10-f5ee7b807fc90756d6852690a3777db7093efe0d.zip
staging:iio:impedance-analyser make use of iio_sw_buffer_preenable
This avoids some code duplication by using the generic form in a non performance critical place. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/iio/impedance-analyzer/ad5933.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 93e5a716f9e..8a0485e6974 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -569,19 +569,14 @@ static const struct iio_info ad5933_info = {
static int ad5933_ring_preenable(struct iio_dev *indio_dev)
{
struct ad5933_state *st = iio_priv(indio_dev);
- size_t d_size;
int ret;
if (bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
return -EINVAL;
- d_size = bitmap_weight(indio_dev->active_scan_mask,
- indio_dev->masklength) *
- ad5933_channels[1].scan_type.storagebits / 8;
-
- if (indio_dev->buffer->access->set_bytes_per_datum)
- indio_dev->buffer->access->
- set_bytes_per_datum(indio_dev->buffer, d_size);
+ ret = iio_sw_buffer_preenable(indio_dev);
+ if (ret < 0)
+ return ret;
ret = ad5933_reset(st);
if (ret < 0)