提交 f5ee7b80 编写于 作者: J Jonathan Cameron 提交者: Greg Kroah-Hartman

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: NJonathan Cameron <jic23@kernel.org>
Acked-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 c562ccbf
...@@ -569,19 +569,14 @@ static const struct iio_info ad5933_info = { ...@@ -569,19 +569,14 @@ static const struct iio_info ad5933_info = {
static int ad5933_ring_preenable(struct iio_dev *indio_dev) static int ad5933_ring_preenable(struct iio_dev *indio_dev)
{ {
struct ad5933_state *st = iio_priv(indio_dev); struct ad5933_state *st = iio_priv(indio_dev);
size_t d_size;
int ret; int ret;
if (bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) if (bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
return -EINVAL; return -EINVAL;
d_size = bitmap_weight(indio_dev->active_scan_mask, ret = iio_sw_buffer_preenable(indio_dev);
indio_dev->masklength) * if (ret < 0)
ad5933_channels[1].scan_type.storagebits / 8; return ret;
if (indio_dev->buffer->access->set_bytes_per_datum)
indio_dev->buffer->access->
set_bytes_per_datum(indio_dev->buffer, d_size);
ret = ad5933_reset(st); ret = ad5933_reset(st);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册