Skip to content

Commit

Permalink
staging:iio:impedance-analyser make use of iio_sw_buffer_preenable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Apr 24, 2012
1 parent c562ccb commit f5ee7b8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/staging/iio/impedance-analyzer/ad5933.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f5ee7b8

Please sign in to comment.